From: SourceForge.net <no...@so...> - 2007-05-18 21:38:18
|
Bugs item #1169499, was opened at 2005-03-23 17:44 Message generated for change (Settings changed) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1169499&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Library Group: Deferred >Status: Closed >Resolution: Fixed Priority: 4 Private: No Submitted By: Todd Carper (toddcarper) Assigned to: Nobody/Anonymous (nobody) Summary: bind values not used by connect in socket.py for tcp Initial Comment: It appears that calling bind to specify the ip address and port on which to bind locally stores the settings but does not provide them to connect. In this case, connect always binds to the primary ip address of the machine. existing code - self.addr, from bind, is not referenced def connect(self, addr, port=None): "This signifies a client socket" if port is not None: addr = (addr, port) assert not self.sock host, port = addr if host == "": host = java.net.InetAddress.getLocalHost() self._setup(java.net.Socket(host, port)) modified code def connect(self, addr, port=None): "This signifies a client socket" if port is not None: addr = (addr, port) assert not self.sock host, port = addr if host == "": host = java.net.InetAddress.getLocalHost() if self.__dict__.has_key("addr"): caddr, cport = self.addr self._setup(java.net.Socket(host, port, java.net.InetAddress.getByName(caddr), cport)) else: self._setup(java.net.Socket(host, port)) There may be a better way to implement the change, but by providing the optional 2 parameters, it is possible to bind to the desired ip address and port. Without the change, applications will generally work, but the primary ip address will always be utilized. Howerver, applications which require usage of a specific IP will not function as desired. ---------------------------------------------------------------------- Comment By: Alan Kennedy (amak) Date: 2007-05-18 16:03 Message: Logged In: YES user_id=647684 Originator: NO This was indeed a bug: it should be possible to bind a client socket to a local address. The old code ignored this fact. I have checked a fix into the new socket module, which is currently in the sandbox but will hopefully be included in the distribution soon. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1169499&group_id=12867 |