示例#1
0
文件: sockets.py 项目: TuskAW/libzt
 def accept(self):
     """Accept connection on the socket"""
     new_conn_fd, addr, port = libzt.zts_py_accept(self._fd)
     if new_conn_fd < 0:
         handle_error(new_conn_fd)
         return None
     return socket(self._family, self._type, self._proto, new_conn_fd), addr
示例#2
0
    def accept(self):
        """accept() -> (socket, address_info)

        Wait for incoming connection and return a tuple of socket object and
        client address info.  This address info may be a tuple of host address
        and port."""
        new_conn_fd, addr, port = libzt.zts_py_accept(self._fd)
        if new_conn_fd < 0:
            handle_error(new_conn_fd)
            return None
        return socket(self._family, self._type, self._proto, new_conn_fd), addr