T.R | Title | User | Personal Name | Date | Lines |
---|
8762.1 | | netrix.lkg.dec.com::thomas | The Code Warrior | Fri Feb 07 1997 18:32 | 1 |
| SO_RCVTIMEO takes a struct timeval, not an int.
|
8762.2 | | VAXCPU::michaud | Jeff Michaud - ObjectBroker | Fri Feb 07 1997 19:03 | 7 |
| > I'm running through the network programming course ....
> if (setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &to, 4) == -1)
^
I'd take off major points right here for hardcoding in a
"magic" number into the code like this. The 4 should
be replaced with "sizeof to" (w/out the quotes).
|
8762.3 | | VAXCPU::michaud | Jeff Michaud - ObjectBroker | Fri Feb 07 1997 19:05 | 8 |
| > SO_RCVTIMEO takes a struct timeval, not an int.
And this looks like .0 should file a QAR against the setsockopt
man page which says:
"SO_RCVTIMEO
Sets receive time out. This option takes an int value."
^^^
|
8762.4 | Thanks a lot | CADSYS::BOGDANOV | | Mon Feb 10 1997 09:09 | 7 |
| > SO_RCVTIMEO takes a struct timeval, not an int.
QAR #51438.
The same mistake was done in internal 'self-peace' cource on Network Application
Programming (EY-K021E-SG-0001).
|
8762.5 | I should have checked it first! | CADSYS::BOGDANOV | | Mon Feb 10 1997 09:28 | 17 |
| > SO_RCVTIMEO takes a struct timeval, not an int.
Oops.
Still cannot get it to work:
struct timeval to;
. . .
to.tv_sec = 2;
to.tv_usec = 0;
if (setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof to ) == -1)
perror("set sock opt"); //, exit(0);
. . .
set sock opt: Argument out of domain
|
8762.6 | | IOSG::MARSHALL | | Mon Feb 10 1997 10:33 | 10 |
| struct timeval to;
. . .
to.tv_sec = 2;
to.tv_usec = 0;
set sock opt: Argument out of domain
WAG: do you explicitly zero all the other elements of the timeval struct?
Scott
|
8762.7 | | VAXCPU::michaud | Jeff Michaud - ObjectBroker | Mon Feb 10 1997 10:39 | 10 |
| >> to.tv_sec = 2;
>> to.tv_usec = 0;
> WAG: do you explicitly zero all the other elements of the timeval struct?
timeval has only the two members above
> set sock opt: Argument out of domain
this sounds like it 2 seconds is not a valid timeout (ie. it's
too small or too big).
|
8762.8 | | CADSYS::BOGDANOV | | Mon Feb 10 1997 10:54 | 5 |
| I got it to work on DUNIX 4.0A .
It looks like a BUG on 3.2D-1.
>> Serge
|