reference:
Tango Server:
http://www.dsource.org/projects/tango/wiki/SocketServerExample
Tango Client:
http://www.dsource.org/projects/tango/wiki/SocketHelloExample

I'm referring to these two examples.
In the server Example, I strip off the client part and it becomes as follow.

void main()
{
        const int port = 8080;

        // thread body for socket-listener
        void run()
        {
                auto server = new ServerSocket (new IPv4Address(port));

                // wait for requests
                auto request = server.accept;

                // write a response
                request.output.write ("server replies 'hello'");              

        }

        Cout("server started");
        while (true )
        {
                // start server in a separate thread, and wait for it to start  
        
                (new Thread (&run)).start;
                tango.core.Thread.thread_sleep (0.250);
        }

}

Situation:

I have my server running and I open a client in another cmd console window and it replied alright. But if I try to connect it again second time, it freezes.

Why is that? I thought the server is constantly receiving messages and replying, why would it freeze up and stop responding? what went wrong?

please advise.

Thanks

Reply via email to