See socket options on existing sockets created by other apps?

Posted by nailer on Stack Overflow See other posts from Stack Overflow or by nailer
Published on 2009-10-24T13:46:18Z Indexed on 2010/03/15 16:49 UTC
Read the original article Hit count: 143

Filed under:
|
|

I'd like to test whether particular socket options have been set on an existing socket. Ie, pretty much everything you can see in:

#!/usr/bin/env python
'''See possible TCP socket options'''

import socket

sockettypelist = [x for x in dir(socket) if x.startswith('SO_')]
sockettypelist.sort()
for sockettype in sockettypelist:
    print sockettype

Anyone know how I can see the options on existing sockets, ie those created by other processes? Alas nearly all the documentation I read on Python socket programming is about making new sockets.

© Stack Overflow or respective owner

Related posts about python

Related posts about socket