Message4070

Author asterio
Recipients asterio
Date 2009-01-24.19:59:35
SpamBayes Score 6.4271592e-09
Marked as misclassified No
Message-id <1232827176.98.0.724752868486.issue1244@psf.upfronthosting.co.za>
In-reply-to
Content
When you let the system choose the port for binding a socket, 
sock.getname() returns ('0.0.0.0', 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: ('127.0.0.1', 0)
Binded to :('127.0.0.1', 1128)
send to :('127.0.0.1', 1128)
OK

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

== jython2.5b0 on linux2 ==
RUNNING on java1.6.0_0 platform: 2.5b0 (trunk:5540, Oct 31 2008, 
13:55:41) 
[OpenJDK Server VM (Sun Microsystems Inc.)]
Binding to: ('127.0.0.1', 0)
Binded to :(u'0.0.0.0', 0)
send to :(u'0.0.0.0', 0)
Traceback (most recent call last):
  File "udp_bind_problem.py", line 19, in <module>
    sock.sendto(data, address2 )
  File "/home/agp/bin/jython2.5b0/Lib/socket.py", line 936, in sendto
    raise _map_exception(jlx)
socket.error: (-1, 'Unmapped exception: java.net.SocketException: 
Invalid argument')
History
Date User Action Args
2009-01-24 19:59:37asteriosetrecipients: + asterio
2009-01-24 19:59:36asteriosetmessageid: <1232827176.98.0.724752868486.issue1244@psf.upfronthosting.co.za>
2009-01-24 19:59:36asteriolinkissue1244 messages
2009-01-24 19:59:36asteriocreate