[ python-Bugs-1308042 ] Datagram Socket Timeouts

SourceForge.net noreply at sourceforge.net
Mon Oct 3 02:44:53 CEST 2005


Bugs item #1308042, was opened at 2005-09-29 07:05
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1308042&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Documentation
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Tom Vrankar (tvrankar)
Assigned to: Nobody/Anonymous (nobody)
Summary: Datagram Socket Timeouts

Initial Comment:
Python 2.4.1, MS Windows 2000 with service packs

I'm trying to have a UDP client check for its server to
start by repeatedly throwing messages at where it's
expected to appear, and then checking for a response. I
set a timeout on the recvfrom, expecting to block for
the timeout and then proceeding to an exception
handler, looping so until data is returned. Instead,
the recvfrom throws an immediate exception "Connection
reset by peer", and I loop rapidly without the
load-softening effect of the timeout (in fact, it's the
same behavior as if I didn't set the timeout at all).
What UDP "connection" is it talking about?

Seems wrong, but is it the implementation or is it me?
If I start the server first, I get one "Invalid
argument" exception in the client. In both cases, once
the server is started, both processes are satisfied.

Thanks.

twv

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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2005-10-02 17:44

Message:
Logged In: YES 
user_id=33168

I added a note near the top of the socket module doc. 

"""Some behavior may be platform dependent, since calls are
made to the operating system socket APIs."""

Let me know if you think something more needs to be done.

Checked in as:
 * Doc/lib/libsocket.tex 1.90, 1.88.2.2

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

Comment By: Tom Vrankar (tvrankar)
Date: 2005-09-30 10:50

Message:
Logged In: YES 
user_id=1353485

With Python around, I don't program much in C anymore, and
for the same reason I usually assume platform independence
(ensured by some clever Python programmer -- C or lib --
spackling over minor underlying differences) unless the
Python docs explicitly tell me otherwise. nnorwitz's Linux
results match my Solaris 8 results (and are what I
intended). I submitted this report since the docs didn't
provide any warnings about Python's UDP sockets behaving
differently per platform. The behavior I saw would be wacky
even on Windoze, but I don't know just how tolerant Windoze
developers are of a poor sockets implementation :-).

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2005-09-29 22:43

Message:
Logged In: YES 
user_id=33168

This is a dupe of 1307357, but I'm closing that one since
most of the comments are here.  However, note this one
comment from twv in the other report that says it also works
on Solaris 8 and could well be Windoze specific.


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

Comment By: Neal Norwitz (nnorwitz)
Date: 2005-09-29 22:30

Message:
Logged In: YES 
user_id=33168

Can you program the client in C and see if it behaves the
same?  Sockets are mostly just wrappers around the OS calls.
 It's possible this is the expected behaviour on Windows and
python is just exposing that to you.

I ran this on Linux and got this (which is what I think you
want):

neal at janus clean $ ./python PyBug/client.py &
[1] 31484
neal at janus clean $ timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
timed out
./python PyBug/server.py
timed out
timed out

timed out
('127.0.0.1', 40899) says CHECK
('127.0.0.1', 3000) says OK
[10587 refs]
[10585 refs]
[1]+  Done                    ./python PyBug/client.py


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

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


More information about the Python-bugs-list mailing list