Date: Mon, 17 Aug 1998 10:43:45 -0600 From: Nate Williams <nate@mt.sri.com> To: Didier Derny <didier@omnix.net> Cc: hackers@FreeBSD.ORG Subject: Re: Yard/FreeBSD Problem (fwd) Message-ID: <199808171643.KAA06909@mt.sri.com> In-Reply-To: <Pine.BSF.3.96.980817141225.25770A-100000@omnix.net> References: <Pine.BSF.3.96.980817141225.25770A-100000@omnix.net>
next in thread | previous in thread | raw e-mail | index | archive | help
> If it is the correct sequence do you have any idea on why it
> does not seem to be working ?
...
> and this is the server:
>
> ===============================
>
> if ((s = socket(AF_INET,SOCK_STREAM,0)) < 0)
> {
> fprintf(stderr,"server: socket() failed. errno = %d\n",errno);
> netlog("server: socket() failed. errno = %d\n",errno);
> exit(1);
> }
>
> if ((sopt = getenv("YARDTCPNODELAY")))
> {
> int flag = 1;
>
> printf("Using socket option TCP_NODELAY to %d\n",flag);
> if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY,(char*)&flag,sizeof(i
> nt)) < 0)
> {
> fprintf(stderr,"server: setsockopt() failed. errno = %d\
> n",errno);
> netlog("server: setsockopt() failed. errno = %d\n",errno
> );
> }
> }
The server-socket from the client should be gotten via an 'accept' call,
not from a raw socket call. The server code above is wrong, as the
setsockopt should be called on the socket you get from accept().
Nate
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808171643.KAA06909>
