hi, i created an application which communicates between a server and one client using serversocket class.is there any way to find the instant at which a client connects and then assign a seperate socket for it. thanks in advance
Basically, you have to put the accept() method call in a forever loop. When accept() returns with a new connection, you have to spawn a new thread to handle that connection and then loop back to the accept() to wait for the next connection. Most of your global variables will have to be moved to the new threaded class. [ June 23, 2008: Message edited by: Norm Radder ]
you need to start a new thread for each client. In server you have the code like this Socket client=ss.accept(); you write a class as Servicethread that extends the thread class when ever the client is connected to server you start the client with ServiceThread st=new ServiceThread(client); st.start(); And the rest of the code is upto you.what you are going to with that client socket.