Like Tree3Likes
  • 2 Post By Elkvis
  • 1 Post By NickJemis

Closesocket

This is a discussion on Closesocket within the Networking/Device Communication forums, part of the General Programming Boards category; Do you need to closesocket() if the other side has already disconnected or it is unnecessary?...

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

    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
    2,590
    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.
    NickJemis and Ducky like this.
    Code:
    namespace life
    {
        const bool change = true;
    }

  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 12:04 PM. Reason: Snipped nonsense words and link to marketing site
    Ducky likes this.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    817
    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, 01:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21