Search code examples
socketsnetwork-programmingtcpnetstat

What does the Recv-Q values in a Listen socket mean?


My program runs in trouble with a netstat output like bellow. It cannot receive a packet. What does the Recv-Q value in the first line mean? I see the man page, and do some googling, but no result found.

[root@(none) /data]# netstat -ntap | grep 8000
tcp      129      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      1526/XXXXX-
tcp        0      0 9.11.6.36:8000          9.11.6.37:48306         SYN_RECV    -
tcp        0      0 9.11.6.36:8000          9.11.6.34:44936         SYN_RECV    -
tcp      365      0 9.11.6.36:8000          9.11.6.37:58446         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.37:55018         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.37:42830         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.37:56344         CLOSE_WAIT  -
tcp        0    364 9.11.6.34:38947         9.11.6.36:8000          FIN_WAIT1   -
tcp      364      0 9.11.6.36:8000          9.11.6.37:52406         CLOSE_WAIT  -
tcp      365      0 9.11.6.36:8000          9.11.6.37:53603         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.37:47522         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.34:48191         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.37:51813         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.34:57789         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.37:34252         CLOSE_WAIT  -
tcp      364      0 9.11.6.36:8000          9.11.6.34:38930         CLOSE_WAIT  -
tcp      365      0 9.11.6.36:8000          9.11.6.37:44121         CLOSE_WAIT  -
tcp      365      0 9.11.6.36:8000          9.11.6.37:60465         CLOSE_WAIT  -
tcp      365      0 9.11.6.36:8000          9.11.6.37:37461         CLOSE_WAIT  -
tcp        0    362 9.11.6.34:35954         9.11.6.36:8000          FIN_WAIT1   -
tcp      364      0 9.11.6.36:8000          9.11.6.37:55241         CLOSE_WAIT  -

P.S. See also at https://groups.google.com/forum/#!topic/comp.os.linux.networking/PoP0YOOIj70


Solution

  • Recv-Q is the Receive Queue. It is the number of bytes that are currently in a receive buffer. Upon reading the socket, the bytes are removed from the buffer and put into application memory. If the Recv-Q number gets too high, packets will be dropped because there is no place to put them.

    More info here netstat