-
socket re-initialize????
I have a Client socket obj in server socket app......
its used for sending and receiving....
Client.Create();
after assigning it to a socket.
Accept(Client,0,0)
I can
Client.Send(data,strlen(data));
after disconnecting from the socket, the Client object is unable to receive any connection when i assign it with Accept(Client,0,0) again....
Is there any re-initialisation that needs to b done?
-
Well...Clients do not use 'Accept()'? The server socket will accept incoming connections but not the client....thus, I do not understand the question here... :confused:
-
serversocket.create()
serversocket.listen()
OnAccept()
{
serversocket.Accept(Clientsocket,0,0)
//when accepting, I assign it to the Client socket object.....
//this is the client object i mean.....
//It is a client socket object in a socket server application
}
-
Okay...it looks like you are using the same client socket over and over again. Thus, it will fail. Of a socket connection is closed, the socket will basically fall into a TIME_WAIT state. This state (between 30 seconds and 4 minutes on a Windows system depending on the registry setting) will allow a socket gracefully. Until this is done, you cannot re-use the socket object.
Usually you create a new socket and assign the current connection to this newly created socket instead of having one permanent client socket...
-
ok......thanks for the info....