/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef	__NIONETSERVERTHREAD__
#define	__NIONETSERVERTHREAD__


		#include "io_net/io_net_server.h"
		#include "thread/mutex.h"
		#include "thread/thread.h"
		#include "thread/atomic_value.h"
		#include "filesystem/io_base.h"
		#include "memory/nshared_ptr.h"
		#include "nstring/nstring.h"


namespace GS {
	namespace IO {

//
class	NetServerThread : public Threading::Thread
{
		String		ip;
		int			port;

		SharedPtr <Base> basefs;
		Threading::Atomic32 state;

		Threading::Mutex server_mutex;
		AutoPtr <NetServer> server;

public:

		void		GetStatistics(NetServer::Statistics &);

		void		Execute();
		bool		Start(const char *ip, int port);
		void		Stop();

		NetServerThread(Base *fs) : basefs(fs) {}
		~NetServerThread();
};

	} // IO
} // GS


#endif	// __NIONETSERVERTHREAD__