Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: function to count pending packets in TCP socket

by Anonymous Monk
on Feb 09, 2018 at 06:56 UTC ( #1208775=note: print w/replies, xml ) Need Help??


in reply to function to count pending packets in TCP socket

Dear Perl Monks,

More than a week has passed since my last post in this thread without any reply. Hence I am assuming that nobody knows a Perl function which returns the send_q value of a socket connection. Meanwhile I helped myself by calling the Linux ss command from Perl and parsing its output. However I see this rather a work around than a clean solution. It imposes OS dependency and it creates a risk my program may fail in future, should any Linux update change the output format of the ss command.

Therefore I am still interested, if a clean solution exists in Perl.

Best regards

Andreas

  • Comment on Re: function to count pending packets in TCP socket

Replies are listed 'Best First'.
Re^2: function to count pending packets in TCP socket
by Anonymous Monk on Feb 09, 2018 at 13:13 UTC

    The ss utility comes from iproute2 package. Sources are freely available for you to read and inspect. The utility is specific to Linux networking.

    Send-Q is obtained either via netlink(7), or parsing /proc/net/tcp (hexadecimal field named tx_queue). You could do the same in perl program: use getpeername and match the right line. Inefficient and cumbersome, but it might suit your purposes.

    Lastly, I would reconsider the approach of building HA/failover capabilities directly into application. Perhaps your questions are better answered on a networking related forum. HAProxy dot org for instance has a mailing list and archive. HtH.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1208775]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2018-06-23 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (125 votes). Check out past polls.

    Notices?