Re: socket.getsockname is returning junk!!
- From: "Gabriel Genellina" <gagsl-py2@xxxxxxxxxxxx>
- Date: Fri, 07 Oct 2011 06:37:12 -0300
En Wed, 05 Oct 2011 08:56:08 -0300, Wong Wah Meng-R32813 <r32813@xxxxxxxxxxxxx> escribió:
I am migrating my application from python 1.5.2 to 2.7.1. One of the existing code breaks. The getsockname method from socket object somehow returns me with some number which I deem as junk, rather than the listening port as I would have expected in the older python. Has anyone seen the same thing or is it due to my python is built with some corrupted library or something?
Python 2.7.1 (r271:86832, Oct 5 2011, 18:34:15) [C] on hp-ux11
Type "help", "copyright", "credits" or "license" for more information.
(0, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')import socket
sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
sock.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, 1 )
sock.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1 )
sock.setsockopt( socket.IPPROTO_TCP, 1, 1 )
In python 1.5.2('10.228.51.41', 11111)server_address=('zmy02aix04', 11111)
I'd say it's a problem with the _socket module; did the unit tests flag anything when you built Python?
On Windows, Python 2.7.1:
('127.0.0.1', 11111)server_address=('lepton', 11111)
- Prev by Date: Re: sending ftp file list to mail???
- Next by Date: Re: A tuple in order to pass returned values ?
- Previous by thread: Re: sending ftp file list to mail???
- Next by thread: RE: socket.getsockname is returning junk!!