UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2008-08-08 03:37 PM

kooth
Member
Registered: 2008-07-15
Posts: 2

Re: Determining listen queue counts

Does anyone know of a way to determine the number of entries on the incomplete connection queue and the completed connection queue?

Offline

#2 2008-08-08 07:57 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Determining listen queue counts

There's no standard method that I'm aware of...  I'd think ioctl(SIOCINQ) should work
to give you the backlog count, but I don't believe it does anywhere...  However,
depending on what system you're on, there may be SOME method of getting at it...
Eg: on Linux, I believe you can obtain it by reading "/proc/net/tcp" (it'll be in place of
the "rx_queue" value, which would normally be the same value returned by the
above-mentioned SIOCINQ for a connected socket)...  I suspect this is going to be
the full backlog (both completed and uncompleted connections)...

Though, I'm not sure why you'd really care about such a thing, anyway...  What are
you trying to accomplish, exactly?

Offline

#3 2008-08-08 11:09 PM

kooth
Member
Registered: 2008-07-15
Posts: 2

Re: Determining listen queue counts

Well, believe it or not, it's for a co-worker.  I think he is trying to monitor the TCP/IP stack in real-time, trying to proactively alert someone if some thresholds become close to being crossed.  Or he could be trying to handle it dynamically.  I thought I read somewhere in Stevens UNIX Network Programming, second addition, that it could be done with ioctl somehow, but I can't find that in his book now.  It's probably just my old age I guess.

I would think that one would do well enough to just let the kernal take care of all of that.  That, plus write code that plays nice!  ;)

But thanks for the answer!  I'll pass that along to him on Monday.

Kooth

Offline

Board footer

Powered by FluxBB