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