From owner-freebsd-net Wed Jul 1 07:24:43 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA22488 for freebsd-net-outgoing; Wed, 1 Jul 1998 07:24:43 -0700 (PDT) (envelope-from owner-freebsd-net@FreeBSD.ORG) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA22482 for ; Wed, 1 Jul 1998 07:24:40 -0700 (PDT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.8.8/8.8.8) id KAA25111; Wed, 1 Jul 1998 10:24:26 -0400 (EDT) (envelope-from wollman) Date: Wed, 1 Jul 1998 10:24:26 -0400 (EDT) From: Garrett Wollman Message-Id: <199807011424.KAA25111@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 In-Reply-To: References: Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org < 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