[Python-bugs-list] [ python-Bugs-701936 ] getsockopt/setsockopt with SO_RCVTIMEO are inconsistent

SourceForge.net noreply at sourceforge.net
Wed Aug 13 22:33:17 EDT 2003


Bugs item #701936, was opened at 2003-03-12 02:54
Message generated for change (Comment added) made by gazzadee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=701936&group_id=5470

Category: Python Library
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Gary Donovan (gazzadee)
Assigned to: Nobody/Anonymous (nobody)
Summary: getsockopt/setsockopt with SO_RCVTIMEO are inconsistent

Initial Comment:
The SO_RCVTIMEO option to getsockopt/setsockopt seems
to vary it's parameter format when used under Linux.

With setsockopt, the parameter seems to be a struct of
{long seconds, long microseconds}, as you would expect
since it's modelling a C "struct timeval".

However, with getsockopt, the parameter format seems to
be {long seconds, long milliseconds} --- ie. it uses
milliseconds rather than microseconds.

The attached python script demonstrates this problem.

Am I doing something crucially wrong, or is this meant
to happen, or ... ?

What I'm using:
Python 2.2.2 (#1, Feb 24 2003, 17:36:09)
[GCC 3.0.4 (Mandrake Linux 8.2 3.0.4-2mdk)] on linux2


----------------------------------------------------------------------

>Comment By: Gary Donovan (gazzadee)
Date: 2003-08-14 04:33

Message:
Logged In: YES 
user_id=693152

Yes, you're right - the same thing happens with C.

Here's the output from sockopt.c on my system:

base (len 8) - 12, 345670
default (len 8) - 0, 0
after setsockopt (len 8) - 12, 20


----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-05-25 02:42

Message:
Logged In: YES 
user_id=33168

I just tested this on my box (Redhat 9/Linux 2.4).  I get
similar results with a C program as Python.  (Not sure why I
didn't get exactly the same results, but I'm tired.)  So I'm
not sure Python has a problem, since it is just exposing
what is happening in C.

Take a look at the C example and try it on your box.  What
results do you get?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=701936&group_id=5470



More information about the Python-bugs-list mailing list