Ok, this has been bothering me for a while. I read on MSDN that you should always call closesocket() after you create a socket using socket(). So I do it. But what I would like to know, is can the socket be re-opened, or does a new socket have to be created? Like, can I do this:
If not, would it work if I used shutdown() instead?Code:SOCKET s = socket(...); connect(s, ...); closesocket(s); connect(s, ...); //Is this ok? (...) //Or do I have to do this SOCKET s = socket(...); connect(s, ...); closesocket(s); SOCKET s2 = socket(...); connect(s2, ...); (...)
**EDIT**
Also, am I right that closesocket() will cause the other end to get a recv() of 0 bytes?