Project

General

Profile

Bug #1429 ยป cwnd.c

Dan McDonald, 2011-08-31 06:41 PM

 
1
#include <sys/socket.h>
2
#include <netinet/tcp.h>
3
#include <netinet/in.h>
4
#include <err.h>
5
#include <stdio.h>
6
#include <stdlib.h>
7

    
8
int
9
main(int argc, char *argv[])
10
{
11
	int s = socket(AF_INET, SOCK_STREAM, 0);
12
	int v = (argc >= 2) ? atoi(argv[1]) : 1;
13

    
14
	if (s == -1)
15
		err(-1, "socket");
16

    
17
	printf("Setting with v = %d.\n", v);
18

    
19
	if (setsockopt(s, IPPROTO_TCP, TCP_INIT_CWND, &v, sizeof (int)) == -1)
20
		err(-1, "setsockopt(TCP_INIT_CWND)");
21

    
22
	printf("Looks like we're good with v = %d.\n", v);
23
	return (0);
24
}
    (1-1/1)