Skip to content

xsyr/IOCompletionPort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

demo

using namespace Framework;
using namespace log4cplus;
using namespace std;
using namespace TcpSocketServerSide;
using namespace Business;
using namespace Business::Handlers;

int _tmain(int argc, _TCHAR* argv[])
{
	Framework::WSAInitializor init;
	ITaskFactory* taskFactory = new DefaultTaskFactory(1);

	SocketServer* server = new TcpSocketServer(
		"192.168.1.103",
		8888,
		taskFactory
		);

	auto dispatcher = new TcpSocketEventDispatcher(*server);
	auto socketFactory = new TcpSocketFactory();
	auto manager = new TcpConnectionManager(*server, *dispatcher, *socketFactory);
	auto handler = new WhisperSocketEventHandler(*server);
	auto serverEventHandler = 
		new WhisperSocketEventHandler::ServerEventHandler(
		*server,
		*handler
		);

	/* register message handler */
	PacketDispatcher& packetDispatcher = handler->GetPacketDispatcher();
	packetDispatcher.Register(new AuthenticateRequestHandler());


	/* register message handler */

	server->SetSocketEventDispatcher(dispatcher);
	server->SetConnectionManager(manager);
	server->SetSocketEventHandler(handler);
	server->SetServerEventHandler(serverEventHandler);

	server->Start();

	/*Sleep(10*1000);*/
	//server->Shutdown();

	server->WaitForShutdown();
	
	/// ......
	return 0;
}

demo

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published