Professional Web Applications Themes

Socket SO_RCVBUF information. - UNIX Programming

Hi, For various reasons I need to how many packets are queued in the SO_RCVBUF of a udp socket. I know there are various mechanisms for detecting if there is one or more packets queued, but I cant find anything to tell me exactly how many are queued. Does anybody have any idea how to get this information. I currently need this for linux. Any ideas would be appreciated. Regards Terry PS. Replace "nobody" in the email address with "trs" to email me....

  1. #1

    Default Socket SO_RCVBUF information.

    Hi,

    For various reasons I need to how many packets are queued in the SO_RCVBUF
    of a udp socket. I know there are various mechanisms for detecting if there
    is one
    or more packets queued, but I cant find anything to tell me exactly how many
    are queued.
    Does anybody have any idea how to get this information. I currently need
    this for linux.

    Any ideas would be appreciated.

    Regards

    Terry
    PS. Replace "nobody" in the email address with "trs" to email me.


    Terry Sanders Guest

  2. #2

    Default Re: Socket SO_RCVBUF information.


    "Terry Sanders" <nobodyvertone.co.uk> wrote in message
    news:UmrXa.13665$SQ1.10546news-binary.blueyonder.co.uk...
    > For various reasons I need to how many packets are queued in the SO_RCVBUF
    > of a udp socket. I know there are various mechanisms for detecting if
    there
    > is one
    > or more packets queued, but I cant find anything to tell me exactly how
    many
    > are queued.
    > Does anybody have any idea how to get this information. I currently need
    > this for linux.
    I don't think anybody will be able to answer your question without
    understanding your actual problem. Just hearing your proposed solution is
    insufficient for us to formulate a solution that will work.

    DS


    David Schwartz Guest

  3. #3

    Default Re: Socket SO_RCVBUF information.


    "Barry Margolin" <barry.margolinlevel3.com> wrote in message
    news:KOuXa.8$GI6.5news.level3.com...
    > In article <UmrXa.13665$SQ1.10546news-binary.blueyonder.co.uk>,
    > Terry Sanders <nobodyvertone.co.uk> wrote:
    > >For various reasons I need to how many packets are queued in the
    SO_RCVBUF
    > >of a udp socket. I know there are various mechanisms for detecting if
    there
    > >is one
    > >or more packets queued, but I cant find anything to tell me exactly how
    many
    > >are queued.
    > >Does anybody have any idea how to get this information. I currently need
    > >this for linux.
    >
    > You could try using the FIONREAD ioctl, but I don't know if it's
    guaranteed
    > to work or portable. However, if it works it will tell you how many bytes
    > are in the queue, not how many packets.
    >
    > Why do you need to know this, anyway? If another packet arrives after the
    > call returns, the information will be wrong.
    >
    Doesn't FIONREAD return the number of bytes in the next udp packet
    (+ addr len) as opposed to the number of bytes in the RCVBUF?

    What I'm doing is developing an application to test the capabilities
    of another. At any one time it has to decide whether to send the next
    packet, read a packet, act on a packet already read (which may involve
    sending another packet), process timeouts on previous packets sent or
    any one of a number of other things. By knowing how many packets are in
    the read queue the application can make decisions on whether in can
    safely ignore the contents of the read queue, until the next pass, in
    favour of processing other parts which may be running behind.

    Terry Sanders


    Terry Sanders Guest

  4. #4

    Default Re: Socket SO_RCVBUF information.

    In comp.protocols.tcp-ip Terry Sanders <nobodyvertone.co.uk> wrote:
    > Doesn't FIONREAD return the number of bytes in the next udp packet
    > (+ addr len) as opposed to the number of bytes in the RCVBUF?
    On HP-UX at least the manpage for ioctl(5) states:

    FIONREAD
    Returns in the long integer whose address is arg the
    number of characters immediately readable from the
    device file.
    > What I'm doing is developing an application to test the capabilities
    > of another. At any one time it has to decide whether to send the next
    > packet, read a packet, act on a packet already read (which may involve
    > sending another packet), process timeouts on previous packets sent or
    > any one of a number of other things. By knowing how many packets are in
    > the read queue the application can make decisions on whether in can
    > safely ignore the contents of the read queue, until the next pass, in
    > favour of processing other parts which may be running behind.
    Sounds like knowing how full the socket buffer with FIONREAD would be
    sufficient - assuming you know in advance the typical datagram sizes
    so you know whether or not you are within N datagrams of overflowing
    the socket buffer.

    rick jones
    --
    a wide gulf separates "what if" from "if only"
    these opinions are mine, all mine; HP might not want them anyway... :)
    feel free to post, OR email to raj in cup.hp.com but NOT BOTH...
    Rick Jones Guest

  5. #5

    Default Re: Socket SO_RCVBUF information.

    "Rick Jones" <foobar.baz.invalid> wrote in message
    news:XuSXa.1469$8%2.658news.cpqcorp.net...
    > In comp.protocols.tcp-ip Terry Sanders <nobodyvertone.co.uk> wrote:
    > > Doesn't FIONREAD return the number of bytes in the next udp packet
    > > (+ addr len) as opposed to the number of bytes in the RCVBUF?
    >
    > On HP-UX at least the manpage for ioctl(5) states:
    >
    > FIONREAD
    > Returns in the long integer whose address is arg the
    > number of characters immediately readable from the
    > device file.
    >
    You're right about this. I can use this with a high/low mark to
    decide on priorities.

    Cheers

    Terry Sanders


    Terry Sanders Guest

  6. #6

    Default Re: Socket SO_RCVBUF information.

    Quote Originally Posted by Terry Sanders View Post
    Hi,

    For various reasons I need to how many packets are queued in the SO_RCVBUF
    of a udp socket. I know there are various mechanisms for detecting if there
    is one
    or more packets queued, but I cant find anything to tell me exactly how many
    are queued.
    Does anybody have any idea how to get this information. I currently need
    this for linux.

    Any ideas would be appreciated.

    Regards

    Terry
    PS. Replace "nobody" in the email address with "trs" to email me.
    Use netstat -a.
    Unregistered Guest

Similar Threads

  1. IO::Socket::SSL
    By Frank in forum PERL Modules
    Replies: 5
    Last Post: December 21st, 08:42 PM
  2. XML Socket to PHP socket
    By The Pickler in forum Adobe Flash, Flex & Director
    Replies: 0
    Last Post: July 17th, 03:31 AM
  3. Socket in PHP
    By Silvio S in forum PHP Development
    Replies: 1
    Last Post: October 8th, 04:37 PM
  4. Replies: 1
    Last Post: September 11th, 01:41 PM
  5. Distinguishing between socket buffer full & socket disconnected
    By John Ramsden in forum PERL Miscellaneous
    Replies: 1
    Last Post: August 5th, 11:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139