[New-bugs-announce] [issue1062] issue message copy
report at bugs.python.org
Thu Aug 30 19:53:20 CEST 2007
New submission from Bill Janssen:
It would be useful to have a way to determine whether a socket is or is
not already bound to a local port (i.e., has had "bind" or "connect"
called on it). It's tempting to call socket.socket.getsockname(), but
the behavior of this method is essentially undefined (i.e., it's
whatever the underlying platform feels like doing, and there seem to be
no constraints on that -- Unix systems typically return what seems to be
someone's idea of a null address, while Windows systems currently raise
an exception.). So an extension API is needed to probe this state.
Suggest adding a method "is_bound" which returns a boolean.
Tracker <report at bugs.python.org>
More information about the New-bugs-announce