Thread: Closesocket

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    895

    Closesocket

    Do you need to closesocket() if the other side has already disconnected or it is unnecessary?
    Compiler MSVC++ 2013 with Code::Blocks.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,260
    if you do not close the socket, the resource may be leaked. it's a good idea to always close a socket when it is no longer in use.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #3
    Registered User NickJemis's Avatar
    Join Date
    Jun 2014
    Location
    Belarus
    Posts
    1
    You only have to close the client socket after you send and recv your data.
    You also want to follow MSDNs preferred method for shutting down communications.
    I would close.
    Last edited by Salem; 06-19-2014 at 11:04 AM. Reason: Snipped nonsense words and link to marketing site

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    895
    Thank you!
    Compiler MSVC++ 2013 with Code::Blocks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. closesocket and shutdown
    By Hunter2 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2003, 12:53 PM