Title: Problem letting system choose the port for binding UDP socket
Type: Severity: normal
Components: Library Versions: 2.5b1
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, asterio
Priority: Keywords:

Created on 2009-01-24.19:59:36 by asterio, last changed 2009-01-28.16:30:05 by amak.

File name Uploaded Description Edit Remove asterio, 2009-01-24.19:59:36 example of bind problem
msg4070 (view) Author: asterio (asterio) Date: 2009-01-24.19:59:35
When you let the system choose the port for binding a socket, 
sock.getname() returns ('', 0) addres instead the real one.

But setting the port, the returned sock address if correct.

This behaviour doesn't appears in python (both win32 or linux2 
platforms) but jython2.5b0

Here some outputs of test script

== python2.5 on win32 ==
RUNNING on win32 platform: 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) 
[MSC v.1310 32 bit (Intel)]
Binding to: ('', 0)
Binded to :('', 1128)
send to :('', 1128)

== python2.4 on linux2 ==
RUNNING on linux2 platform: 2.4.5 (#2, Aug  1 2008, 02:20:59) 
[GCC 4.3.1]
Binding to: ('', 0)
Binded to :('', 45506)
send to :('', 45506)

== jython2.5b0 on linux2 ==
RUNNING on java1.6.0_0 platform: 2.5b0 (trunk:5540, Oct 31 2008, 
[OpenJDK Server VM (Sun Microsystems Inc.)]
Binding to: ('', 0)
Binded to :(u'', 0)
send to :(u'', 0)
Traceback (most recent call last):
  File "", line 19, in <module>
    sock.sendto(data, address2 )
  File "/home/agp/bin/jython2.5b0/Lib/", line 936, in sendto
    raise _map_exception(jlx)
socket.error: (-1, 'Unmapped exception: 
Invalid argument')
msg4100 (view) Author: Alan Kennedy (amak) Date: 2009-01-28.16:30:04
This is indeed a bug; thanks for reporting it and thanks for supplying
code which illustrated the problem.

Fix checked into trunk at r5992, and release 22 at r5993.

Until the next release, you can download the fixed module from SVN
Date User Action Args
2009-01-28 16:30:05amaksetstatus: open -> closed
versions: + 2.5b1, - 2.5b0
nosy: + amak
messages: + msg4100
assignee: amak
resolution: fixed
2009-01-24 19:59:36asteriocreate