On Thu, Jan 11, 2001 at 03:10:01PM -0800, David S. Miller wrote:
> James R. Leu writes:
> > It seems that TCPs recvmsg/sendmsg and ioctl for SIOCINQ/SIOCOUTQ do not
> > check to make sure the socket is connected.
> And what is the problem with that?
> If the socket is in the process of connecting (SYN_SENT or SYN_RECV)
> then SIOCINQ/SIOCOUTQ will report zero. If closed or closing, it will
> report zero since by definition all data is sent. The only invalid
> case is LISTEN, and we flag this with -EINVAL.
This makes sense. I interpreted the The man page for tcp(4) to say that
FIONREAD and TIOCOUTQ would leave errno equal to EPIPE if the socket was
> For sendmsg/recvmsg you _want_ the kernel to wait for the connection
> attempt to complete if we are in SYN_SENT or SYN_RECV. If this is not
> what is happening (the socket is some other kind of "closed") you will
> get an EPIPE (and perhaps a SIGPIPE signal) back. This is all done
> via wait_for_tcp_connect in net/ipv4/tcp.c
In the code I see how sendmsg/recvmsg end up returning -EPIPE if the local
side has been shutdown (sk->shutdown & SEND_SHUTDOWN). What should I expect
if I close down the remote side of the socket?
James R. Leu