TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Mike Burgett
date: 1996-05-21 18:02:46
subject: Socket API question...

Does anyone here have any experience using get/setsockopt with the 
SO_SNDTIMEO or SO_RCVTIMEO options?  It's barely mentioned in the tcppr.inf
that I have from the latest devcon, as a matter of fact, it's not mentioned
in the supported options, but is mentioned in the discussion of
SOCEWOULDBLOCK error on an error return from send() and recv().

Basically, I'm doing:

typedef struct _timeval 
{
  int tv_sec;
  int tv_usec;
} timeval;

[ ... ]

timeval temp1;
int tempsize = sizeof(struct _timeval);

temp1.tv_sec = 1;
temp1.tv_usec = 0;

setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &temp1, sizeof(struct _timeval));

getsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &temp1, &tempsize);

setsockopt returns an error SOCEINVAL, and getsockopt returns a SOCENOPROTOOPT
(which is what I would expect them both to return if they didn't understand
the option at all.)

SO_SNDTIMEO and SO_RCVTIMEO are both listed in the
tcpip/include/sys/socket.h file, under the "additional options, not
kept in so_options" area.

Has anyone else been here, and done this before?

Thanks,
Mike

... Brought to you by the letters O and S, and by the number 2

--- FleetStreet 1.14 #514
* Origin: Common Sense BBS - (510) 713-7336 Newark, CA (1:215/705)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1
@PATH: 215/705 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.