Get bind addresses as (host,port) tuples for process pid.
(pid)
| 74 | return result |
| 75 | |
| 76 | def get_bind_addrs(pid): |
| 77 | ''' |
| 78 | Get bind addresses as (host,port) tuples for process pid. |
| 79 | ''' |
| 80 | inodes = get_socket_inodes(pid) |
| 81 | bind_addrs = [] |
| 82 | for conn in netstat('tcp') + netstat('tcp6'): |
| 83 | if conn[3] == STATE_LISTEN and conn[4] in inodes: |
| 84 | bind_addrs.append(conn[1]) |
| 85 | return bind_addrs |
| 86 | |
| 87 | # from: http://code.activestate.com/recipes/439093/ |
| 88 | def all_interfaces(): |
no test coverage detected