Date: Wed, 1 Jul 1998 10:24:26 -0400 (EDT) From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> To: smoergrd@oslo.geco-prakla.slb.com (Dag-Erling Coidan Smørgrav) Cc: net@FreeBSD.ORG Subject: Length of incoming UDP datagrams Message-ID: <199807011424.KAA25111@khavrinen.lcs.mit.edu> In-Reply-To: <rx4yaud4vck.fsf@oslo.geco-prakla.slb.com> References: <rx4yaud4vck.fsf@oslo.geco-prakla.slb.com>
next in thread | previous in thread | raw e-mail | index | archive | help
<<On 01 Jul 1998 14:19:23 +0200, smoergrd@oslo.geco-prakla.slb.com (Dag-Erling Coidan Smørgrav) said: > Is there any way to obtain information about the length of an incoming > UDP datagram short of actually receiving it in a large enough > buffer? >From /sys/kern/sys_socket.c: case FIONREAD: *(int *)data = so->so_rcv.sb_cc; return (0); That will actually give you the total amount waiting in the buffer, not just the first packet. Of course, UDP/IP also gives you a strict upper bound of 65534-20-8 = 65506 bytes per packet. -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, CRS, or NSA| - Susan Aglukark and Chad Irschick To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807011424.KAA25111>