From: Uncle George <gatgul@voicenet.com>
To: linux-net@vger.rutgers.edu, axp-list@redhat.com
Subject: setting (set/get)sockopt(,SO_RCVBUF doesn't set high water mark
Date: Thu, 07 Dec 2000 09:06:40 -0500 [thread overview]
Message-ID: <3A2F9970.2CA146A8@voicenet.com> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=x-user-defined, Size: 435 bytes --]
I seems like setting the high water mark for a DATAGRAM socket just does
not take hold. any request for less that 256 bytes ( ie 2 bytes ) gets
uped to 256.
From docs & stevens book, one is setting/getting the max size of the
(data?) in the datagram pkt. Apparently linux has a different viewpoint.
I think setting ( or suggesting) the
high water mark should result in a value <= to that set ( but not larger
! )
/gat
[-- Attachment #2: a.c --]
[-- Type: application/octet-stream, Size: 1212 bytes --]
#include <stdio.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
main()
{
int i;
int four;
int *address_of_four = &four;
int s;
int ret;
struct sockaddr_in lcladdr;
int port = 0;
s = socket( AF_INET, SOCK_DGRAM, 0 );
if ( s == -1 ) {
printf("Canna open a socket\n");
exit(2);
}
memset((char *) &lcladdr, 0, sizeof(lcladdr));
lcladdr.sin_family = AF_INET;
lcladdr.sin_port = htons((short)port);
lcladdr.sin_addr.s_addr = INADDR_ANY;
ret = bind(s, (struct sockaddr *)&lcladdr, sizeof(lcladdr));
if (ret==-1){
printf("Bind failed \n");
exit(2);
}
for (i = 8196; i ; i--)
{
int arg;
arg = i;
ret = setsockopt(s, SOL_SOCKET, SO_RCVBUF,
(char *)&arg, sizeof(arg));
if ( ret < 0 ) {
printf("Setsockopt:SO_RCVBUF failed for %d\n", arg);
exit(3);
}
ret = getsockopt(s, SOL_SOCKET, SO_RCVBUF,
(char *)&arg, address_of_four);
if ( ret < 0 ) {
printf("Getsockopt:SO_RCVBUF failed for %d\n", arg);
exit(4);
}
if ( arg != i ) {
printf("SO_RCVBUF Failed to take: get:%d != set:%d \n",
arg, i );
}
}
}
reply other threads:[~2000-12-07 13:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox