FreeBSD Bugzilla – Attachment 103916 Details for
Bug 144000
[tcp] setting TCP_MAXSEG by setsockopt() does not seem to have any effect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.txt
file.txt (text/plain), 2.58 KB, created by
Andrey Zonov
on 2010-02-16 12:20:02 UTC
(
hide
)
Description:
file.txt
Filename:
MIME Type:
Creator:
Andrey Zonov
Created:
2010-02-16 12:20:02 UTC
Size:
2.58 KB
patch
obsolete
>#include <sys/types.h> >#include <sys/socket.h> >#include <sys/uio.h> >#include <netinet/in.h> >#include <netinet/tcp.h> >#include <arpa/inet.h> >#include <err.h> >#include <stdlib.h> >#include <strings.h> >#include <unistd.h> > >static char buf[] = "test echo"; > >int >main(void) >{ > int s, maxseg; > struct sockaddr_in serv; > > bzero(&serv, sizeof(serv)); > serv.sin_family = AF_INET; > serv.sin_port = htons(5555); > inet_pton(AF_INET, "localhost", &serv.sin_addr); > > s = socket(AF_INET, SOCK_STREAM, 0); > > maxseg = 300; > if (setsockopt(s, IPPROTO_TCP, TCP_MAXSEG, (const void *) &maxseg, sizeof(maxseg)) != 0) { > err(1, "setsockopt():"); > } > > if ((connect(s, (const struct sockaddr *) &serv, sizeof(serv))) == 0) { > write(s, buf, 9); > } > close(s); > > exit(0); >} > >#include <sys/types.h> >#include <sys/socket.h> >#include <sys/uio.h> >#include <netinet/in.h> >#include <stdlib.h> >#include <strings.h> >#include <unistd.h> > >#define SIZE 4096 > >int >main(void) >{ > int s, s1, r; > char buf[SIZE]; > struct sockaddr_in sin; > > s = socket(AF_INET, SOCK_STREAM, 0); > > bzero(&sin, sizeof(sin)); > sin.sin_family = AF_INET; > sin.sin_port = htons(5555); > > bind(s, (const struct sockaddr *)&sin, sizeof(sin)); > > listen(s, -1); > > s1 = accept(s, (struct sockaddr *) NULL, NULL); > > while ((r = read(s1, buf, SIZE)) > 0) { > write(s1, buf, r); > } > close(s1); > > exit(0); >} > ># tcpdump -pni lo0 port 5555 >tcpdump: verbose output suppressed, use -v or -vv for full protocol decode >listening on lo0, link-type NULL (BSD loopback), capture size 96 bytes >15:05:57.371757 IP 127.0.0.1.39043 > 127.0.0.1.5555: Flags [S], seq 2639122865, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 27362 ecr 0], length 0 >15:05:57.371900 IP 127.0.0.1.5555 > 127.0.0.1.39043: Flags [S.], seq 1718559353, ack 2639122866, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 604177474 ecr 27362], length 0 >15:05:57.371902 IP 127.0.0.1.39043 > 127.0.0.1.5555: Flags [.], ack 1, win 8960, options [nop,nop,TS val 27362 ecr 604177474], length 0 >15:05:57.372005 IP 127.0.0.1.39043 > 127.0.0.1.5555: Flags [P.], ack 1, win 8960, options [nop,nop,TS val 27362 ecr 604177474], length 9 >15:05:57.372081 IP 127.0.0.1.39043 > 127.0.0.1.5555: Flags [F.], seq 10, ack 1, win 8960, options [nop,nop,TS val 27362 ecr 604177474], length 0 >15:05:57.372104 IP 127.0.0.1.5555 > 127.0.0.1.39043: Flags [.], ack 11, win 8958, options [nop,nop,TS val 604177474 ecr 27362], length 0 >15:05:57.372263 IP 127.0.0.1.5555 > 127.0.0.1.39043: Flags [P.], ack 11, win 8960, options [nop,nop,TS val 604177474 ecr 27362], length 9 >15:05:57.372265 IP 127.0.0.1.39043 > 127.0.0.1.5555: Flags [R], seq 2639122876, win 0, length 0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 144000
: 103916 |
103917
|
103918