Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* setting (set/get)sockopt(,SO_RCVBUF doesn't set high water mark
@ 2000-12-07 14:06 Uncle George
  0 siblings, 0 replies; only message in thread
From: Uncle George @ 2000-12-07 14:06 UTC (permalink / raw)
  To: linux-net, axp-list

[-- 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 );
		}
	}
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-12-07 13:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-07 14:06 setting (set/get)sockopt(,SO_RCVBUF doesn't set high water mark Uncle George

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox