hi all,

just a stupid question:

if i create a socket and do "connect" to a XX.YYY.ZZZ.WWW address, when i've finish to comunicate, could i just close the connection without closing the socket and then connect to another address using the same open socket ?

THX B7
Posted on 2003-01-17 10:36:40 by Bit7
Yes, u can reuse the socket handle, I've done it before.
Posted on 2003-01-17 11:17:47 by Homer
ok, but how ?????

I should just do another "connect" and this automatically terminate the previous connection ?
Posted on 2003-01-17 11:33:48 by Bit7
Once you are finished with the first connection, just terminte it using the "closesocket" function. Once this is done, then you just call the "connnect" function again, passing the same socket handle.
Posted on 2003-01-18 08:21:02 by IRBMe

Once you are finished with the first connection, just terminte it using the "closesocket" function. Once this is done, then you just call the "connnect" function again, passing the same socket handle.


The PSDK doesn't agree with you:
The closesocket function closes a socket. Use it to release the socket descriptor s so that further references to s fail with the error WSAENOTSOCK.


Thomas
Posted on 2003-01-18 09:00:27 by Thomas
sorry but i don't think i cac use closesocket anyway, i was using sockets with linux and i don't see this function as available :(


THX anyway, @ the moment i'm closing and recreating the socket.
Posted on 2003-01-20 12:15:53 by Bit7
The function closesocket is the windows equalent for close, when using on sockets.
It's because on windows, socket handles are not equal to file handles.

-Stealth
Posted on 2003-01-20 23:30:18 by Stealth