test_socket.py failure
Nick Coghlan
ncoghlan at iinet.net.au
Tue Feb 1 22:03:25 EST 2005
x2164 at mailcity.com wrote:
> At the interactive python prompt i did/got the following:
>
> bash-2.04$ ./python
> Python 2.4 (#1, Jan 29 2005, 10:31:35)
> [GCC 2.95.3 20010315 (release)] on linux2
> Type "help", "copyright", "credits" or "license" for
> more information.
> >>> import socket
> >>> socket.getservbyname('daytime', 'tcp')
> 13
>
> # The 13 looks ok but look what happen
> # when i asked only for the service, like
> # the line that fails in test_socket.
>
> >>> socket.getservbyname('daytime')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> socket.error: service/proto not found
> >>>
Hmm, when the second argument is omitted, the system call looks like:
getservbyname("daytime", NULL);
Based on "man getservbyname" on my Linux PC, that should give the behaviour we
want - any protocol will match.
However:
Linux 2.6.4-52-default (Suse 9.1)
Glibc 2.3.3
gcc 3.3.3
So it may be that your older platform doesn't have this behaviour - I'd be very
interested in what 'man getservbyname' has to say.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at email.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
More information about the Python-list
mailing list