[Python-bugs-list] [ python-Feature Requests-706392 ] faster _socket.connect variant desired

SourceForge.net noreply@sourceforge.net
Sat, 29 Mar 2003 07:08:48 -0800


Feature Requests item #706392, was opened at 2003-03-19 18:14
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=706392&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Marcus Mendenhall (mendenhall)
Assigned to: Nobody/Anonymous (nobody)
Summary: faster _socket.connect variant desired

Initial Comment:
The  _socket.connect() call is not quite semantically equivalent to the underlying bsd connect() call in that it always parses an internet address.  This process can be quite slow, since it attempts to determine names and cnames (etc) using getaddrinfo(), which may require DNS lookups to complete.  In an environment where many sockets are being connected and disconnected, this is expensive.  

I would like to propose two minor additions to the _socket module:

1) A python wrapper to the internal getsockaddrarg(), allowing a fully processed socket address to be returned as a string

2) a connect_raw_address() call which is a pure wrapper to the bsd connect() call, and which assumes it is passed a string from getsockaddrarg().

This would allow a socket to be disconnected and reconnected many times to the same address, but with much less network chatter and OS overhead.  Effectively, I would like an unbundled version of _socket.connect(), with each of the two processes it uses able to be carried out independently.  

This is also useful in environments where one is communicating on aprivate network which is connected to the outside world over a (for example) PPP or PPPoE link.  Internal traffic handled through this connect will not result in gratuitous DNS traffic which will keep the link from ever closing.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2003-03-29 16:08

Message:
Logged In: YES 
user_id=21627

I think this requires creating a struct sockaddr wrapper
object. Would you be interested in developing a patch?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=706392&group_id=5470