Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

Winsock, does 'shutdown' disconnect?

This topic is 5172 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am wondering if the command shutdown actually disconnects the socket connection? And you would only use closesocket to reset a socket so you can rebind it etc? thanks

Share this post


Link to post
Share on other sites
Advertisement
Correct on shutdown().

Once a socket has been closed, it is not long valid. You would need to create a new socket.

Kuphryn

Share this post


Link to post
Share on other sites
You cannot re-bind a socket once bound.

::shutdown() does not allow you to re-bind; it just will make the implementation start returning errors if you try to read (or write) on the socket. It's a somewhat ill specified system call, in that it doesn't have any immediate affect on the underlying network protocol, and most programs do not use it.

::closesocket() closes the socket, just like closing a file. Then you can then call ::socket() to create a new socket, and ::bind() it to some other port.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!