graceful socket close



Hello,

I would like to make sure that after calling closesocket(), Winsock
will not do the FIN/FIN-ACKs in the background, and I would like it to
block.

As written in the MSDN I did the following:


1. Set my (blocking) socket to SO_LINGER with a timeout
2. Called shutdown()
3. Call closesocket

I would expect closesocket to block until the graceful socket closure
is ended, however closesocket returns immediatly before the final close
(When blocking communication right after closesocket returns, the
socket is in LAST_ACK state in netstat).

I've also tried using WSAEventSelect and wait on FD_CLOSE event, and it
did not help either.

Does anyone have an idea?

Thanks!
Ran

.



Relevant Pages

  • Re: Problem receiving Multicast traffic transmitted on receiving inter
    ... when using a separate receiver socket, ... I have a service that both sends and receives multicast frames. ... closesocket; ... sizeof ) == SOCKET_ERROR) ...
    (microsoft.public.windowsce.embedded)
  • Re: socket question: how to use sendto and recvfrom based on the same multicast address
    ... Why don't you just use the same socket for both send and receive? ... multicast address and receive other data from others on the samd ... closesocket; ... if (setsockopt (sockrcv, ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Pending WSARecv do not return when closesocket() is called
    ... Incidentally, does closesocket() return SOCKET_ERROR? ... cmd.exe and the output of cmd.exe is sent back to the client socket. ... All of this is done through 1 IOCP (socket send/read and named pipe ...
    (microsoft.public.win32.programmer.networks)
  • Re: graceful socket close
    ... Arkady ... > I would like to make sure that after calling closesocket(), ... Set my socket to SO_LINGER with a timeout ... > (When blocking communication right after closesocket returns, ...
    (microsoft.public.win32.programmer.networks)
  • Re: recv() hang
    ... Do you open the socket as OVERLAPPED? ... you call shutdown before closesocket? ... the typical sequence is to detect a broken connection thru failed send / ...
    (microsoft.public.win32.programmer.networks)