def get_connections(self, kind='inet'): """Return etwork connections opened by a process as a list of namedtuples. """ if kind not in conn_tmap: raise ValueError("invalid %r kind argument; choose between %s" % (kind, ', '.join([repr(x) for x in conn_tmap]))) families, types = conn_tmap[kind] ret = _psutil_osx.get_process_connections(self.pid, families, types) return [ntuple_connection(*conn) for conn in ret]
def get_connections(self, kind='inet'): """Return etwork connections opened by a process as a list of namedtuples. """ if kind not in conn_tmap: raise ValueError("invalid %r kind argument; choose between %s" % (kind, ', '.join([repr(x) for x in conn_tmap]))) families, types = conn_tmap[kind] rawlist = _psutil_osx.get_process_connections(self.pid, families, types) ret = [] for item in rawlist: fd, fam, type, laddr, raddr, status = item status = TCP_STATUSES[status] nt = nt_connection(fd, fam, type, laddr, raddr, status) ret.append(nt) return ret
def get_connections(self): """Return etwork connections opened by a process as a list of namedtuples.""" retlist = _psutil_osx.get_process_connections(self.pid) return [ntuple_connection(*conn) for conn in retlist]