CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Huntsville, AL
    Posts
    54

    FD_CLOSE problem in Sockets

    In Closing a Stream connection, I fail to receive the FD_CLOSE from the Server Side.

    I am using Winsock2. ... NOT any version of MFC sockets.

    I use WSAEventSelect to receive the event FD_CLOSE.

    I as testing my code using both the Client side and Server side
    in the same program and same computer.

    Per all the documentation, I am trying for a graceful shut down of the socket connection instead of an aborted one.

    I have a seperate thread that handles network events .... in this test it is doing both the Server and Client side processing.

    Client issues shutdown(SD_SEND);

    Network event thread receives FD_CLOSE for Server side socket.

    Server side FD_CLOSE processing:
    Issues shutdown(SD_SEND);
    Loop until no data from rcv()
    Issues socketclose();

    I am expecting a FD_CLOSE to be received by the network thread for the Client socket based on the Server's shutdown()

    The Client side FD_CLOSE NEVER appears!!!!

    If I remove the socketclose from the Server side code .... all works well but I'm left with a unclosed socket on the Server side.

    Is the problem that my test bed is the same computer/program??

    Any insight please.

  2. #2
    Join Date
    Feb 2002
    Posts
    5,757
    I recommend calling closesocket() right after shutdown() if you know that the socket is not processing data.

    Kuphryn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured