|
-
October 6th, 2003, 08:47 PM
#1
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?
-
October 6th, 2003, 11:46 PM
#2
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...
-
October 7th, 2003, 04:52 AM
#3
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
}
-
October 7th, 2003, 05:04 AM
#4
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...
-
October 7th, 2003, 06:14 AM
#5
ok......thanks for the info....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|