[Python-bugs-list] [ python-Feature Requests-567972 ] Missing 4 socket object properties

noreply@sourceforge.net noreply@sourceforge.net
Sat, 15 Jun 2002 06:21:46 -0700


Feature Requests item #567972, was opened at 2002-06-12 13:56
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=567972&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Graham Horler (grahamh)
Assigned to: Nobody/Anonymous (nobody)
Summary: Missing 4 socket object properties

Initial Comment:
The C socketmodule has a struct PySocketSockObject, 
with family, type and proto members.

These would be terribly helpful to have access to in 
Python, when implementing some generic socket helper 
functions.

The "blocking" flag could also be made available, but 
would require some extra coding.

(I'm using Python 2.1.3 under Linux 2.4.16, so I cannot 
extend the socket class itself ((as in py2.2)), and don't 
want to slow down sockets with a complete wrapper, as I 
use them heavily.)

Thanks, Graham.

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

>Comment By: Martin v. Löwis (loewis)
Date: 2002-06-15 15:21

Message:
Logged In: YES 
user_id=21627

Sounds good. Would you like to produce a patch implementing
this feature?

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

Comment By: Graham Horler (grahamh)
Date: 2002-06-12 14:00

Message:
Logged In: YES 
user_id=543663

Oh yes, the repr of a socket object includes the missing info, 
so to get hold of the family, I go:
  int(repr(sock).split(' ')[3].split('=')[1][:-1])

Similar for type and protocol, not nice!


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

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