コード例 #1
0
 def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):
     """Constructor.  May be extended, do not override."""
     BaseServer.__init__(self, server_address, RequestHandlerClass)
     self.socket = socket.socket(self.address_family,
                                 self.socket_type)
     if bind_and_activate:
         self.server_bind()
         self.server_activate()
コード例 #2
0
    def connect_to_server(self):
        from _pydev_imps import _pydev_socket as socket

        self.socket = s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        try:
            s.connect((HOST, self.port))
        except:
            sys.stderr.write('Error on connect_to_server with parameters: host: %s port: %s\n' % (HOST, self.port))
            raise
コード例 #3
0
 def __init__(self,
              server_address,
              RequestHandlerClass,
              bind_and_activate=True):
     """Constructor.  May be extended, do not override."""
     BaseServer.__init__(self, server_address, RequestHandlerClass)
     self.socket = socket.socket(self.address_family, self.socket_type)
     if bind_and_activate:
         self.server_bind()
         self.server_activate()
コード例 #4
0
    def connectToServer(self):
        from _pydev_imps import _pydev_socket as socket

        self.socket = s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        try:
            s.connect((HOST, self.port))
        except:
            sys.stderr.write(
                'Error on connectToServer with parameters: host: %s port: %s\n'
                % (HOST, self.port))
            raise
コード例 #5
0
def get_socket_name():
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    sock.bind(('', 0))
    return sock.getsockname()