This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: getsockopt/setsockopt with SO_RCVTIMEO are inconsistent
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: gazzadee, nnorwitz
Priority: normal Keywords:

Created on 2003-03-12 02:54 by gazzadee, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
getsockopt_test.py gazzadee, 2003-03-12 22:38 Demonstrates the problem on Linux
sockopt.c nnorwitz, 2003-05-25 02:42 c example
Messages (5)
msg15085 - (view) Author: GaryD (gazzadee) Date: 2003-03-12 02:54
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
msg15086 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-05-25 02:42
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?
msg15087 - (view) Author: GaryD (gazzadee) Date: 2003-08-14 04:33
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
msg15088 - (view) Author: GaryD (gazzadee) Date: 2004-06-04 02:53
Logged In: YES 
user_id=693152

What do we do about this? Since it does not seem to be an
explciitly python problem, do we just resolve it as
"Rejected" or "Wont Fix"?
msg15089 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2004-06-07 03:56
Logged In: YES 
user_id=33168

Yes, I think this is not appropriate for Python to try to
resolve.  It would be very difficult to get right for all
platforms.  Thanks for the reminder.
History
Date User Action Args
2022-04-10 16:07:35adminsetgithub: 38150
2003-03-12 02:54:49gazzadeecreate