[IronPython] socket.getfqdn problem on 2.6.1 RC1.

Carlos Alberto Costa Beppler beppler at gmail.com
Wed Apr 7 16:26:26 CEST 2010


Hi, I´m trying to use the HTTPServer class from de BaseHTTPServer.py
on standard library on IronPython 2.6.1 RC1.

But the server stops with an socket exception on startup as shown bellow.

C:\Program Files\Tools>ipy
IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.3607
Type "help", "copyright", "credits" or "license" for more information.
>>> import BaseHTTPServer
>>> BaseHTTPServer.test()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\IronPython\Lib\BaseHTTPServer.py", line 584, in test
  File "C:\Program Files\IronPython\Lib\SocketServer.py", line 400, in __init__
  File "C:\Program Files\IronPython\Lib\BaseHTTPServer.py", line 110, in server_
bind
ValueError: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses
that cannot be used as a target address.
Parameter name: hostNameOrAddress

This is because the method getfqdn of the socket class is blowing up
when the string '0.0.0.0' is passed to it. For example:

C:\Program Files\Tools>ipy
IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.3607
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getfqdn('0.0.0.0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses
that cannot be used as a target address.
Parameter name: hostNameOrAddress

On CPython the same call returns the current host name, like bellow.

C:\Users\beppler>python
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getfqdn('0.0.0.0')
'Beppler.mps.interno'
>>>


Is it possible to fix this for the 2.6.1 release?



More information about the Ironpython-users mailing list