Tango Server Example

JJDuck via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 19 09:56:59 PDT 2014


I modify the server program as follow and it works ok. But how do 
I use thread to expedite the execution?

void main()
{
	const int port = 8080;

	auto server = new ServerSocket (new IPv4Address(port));
	Cout("server started");
	while (true )
	{
		// wait for requests
		auto request = server.accept;
		// write a response
		request.output.write ("server replies 'hello'");		
		request.close;
	}
}


More information about the Digitalmars-d-learn mailing list