Re: Need Help with IOCP

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Brendan Rempel (brendan_at_n0sp4msonicmobility.com)
Date: 04/19/04


Date: Mon, 19 Apr 2004 12:46:21 -0600

Here's some more detail on what's going on:

struct linger li = { 0, 0 }; // Default: SO_DONTLINGER
int err;
err = setsockopt(m_Socket, SOL_SOCKET, SO_LINGER, (char *)&li, sizeof(li));
 - err returns 0, success

err = shutdown(m_Socket, SD_BOTH);
 - err returns 10057. Although this means that the socket is not connected,
it really is. The client side has not received notication that the
connection has been closed.

closesocket(m_Socket);
 - the client immediately receives a network error and closes its connection
as this line executes.

Removing setsockopt call changes the return value of shutdown to -1
(undocumented return for shutdown). Adding while(Read) to any stage like
previously suggested also has no affect.

I found I can trick the incoming socket to start its completion routine by
calling WriteFileEx with zero bytes, however this hasn't made any change on
the outcome of the bug. If there's any suggestions, I would appreciate it
greatly.

Brendan

"Brendan Rempel" <brendan@n0sp4msonicmobility.com> wrote in message
news:u0r7K3hJEHA.1132@TK2MSFTNGP12.phx.gbl...
> Sibling as in part of the same list of sockets in the same list of IOCP
> threads. This is just a middle tier and when the server I connect to
closes
> a socket, I must close the connection to the client that connected to me.
>
> The problem is when this happens. I do get notified that the server has
> closed my outgoing connection and I can close my incoming connection.
> However, the client only gets partially notifed of the socket close. A
test
> program like telnet doesn't care, but Internet Explorer will abort and
show
> an error. According to a packet sniffer, only about half of the TCP ACKs
> are being transmitted either way which is tricks clients into thinking
> there's a network error. All the payload data does get transmitted.
<clip>



Relevant Pages

  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #3]
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... kernel socket family. ... presentation side is left to the client. ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... Make it possible for the client socket to be used to go to more than one ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #2]
    ... These patches together supply secure client-side RxRPC connectivity as a Linux ... Make it possible for the client socket to be used to go to more than one ... Each connection goes to a particular "service". ...
    (Linux-Kernel)
  • [PATCH 00/16] AF_RXRPC socket family and AFS rewrite [try #3]
    ... The first of these patches together provide secure client-side RxRPC ... connectivity as a Linux kernel socket family. ... Make certain parameters (such as connection timeouts) userspace ... the connectaddress of a client socket by making use of msg_name in the ...
    (Linux-Kernel)
  • [PATCH 00/16] AF_RXRPC socket family and AFS rewrite [try #4]
    ... The first of these patches together provide secure client-side RxRPC ... connectivity as a Linux kernel socket family. ... Make certain parameters (such as connection timeouts) userspace ... the connectaddress of a client socket by making use of msg_name in the ...
    (Linux-Kernel)