Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Oct 2005 01:23:22 +0300
From:      Lefteris Tsintjelis <lefty@ene.asda.gr>
To:        freebsd-stable@freebsd.org
Subject:   setsockopt and SO_RCV/SNDTIMEO
Message-ID:  <4345A3DA.1020803@ene.asda.gr>

next in thread | raw e-mail | index | archive | help
Hi,

I am trying to set something like this up but it doesn't seem to work
as I expect it (unless I expect wrong):

timeout.tv_sec = 4;
timeout.tv_usec = 0;
if(setsockopt(listenSocket, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, sizeof(timeout)) == -1)
	fprintf(stdout, "setsockopt SO_RCVTIMEO failed: %s\n", strerror(errno));
if(setsockopt(listenSocket, SOL_SOCKET, SO_SNDTIMEO, (void *)&timeout, sizeof(timeout)) == -1)
	fprintf(stdout, "setsockopt SO_SNDTIMEO failed: %s\n", strerror(errno));

When I telnet to the socket, the socket always stays connected. The
timer doesn't seem to work right. Am I missing anything here or is
this broken?

Please CC

Thnx,

Lefteris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4345A3DA.1020803>