Message53804
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. |
|
Date |
User |
Action |
Args |
2007-08-23 16:06:29 | admin | link | issue706392 messages |
2007-08-23 16:06:29 | admin | create | |
|