How to use the continuum.server.Server function in continuum

To help you get started, we’ve selected a few continuum examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zyantific / continuum / continuum / __init__.py View on Github external
def create_server_if_none(self):
        """Creates a localhost server if none is alive, yet."""
        # Server alive?
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        server_port = self.read_or_generate_server_port()
        try:
            sock.connect(('127.0.0.1', server_port))
        except socket.error:
            # Nope, create one.
            print("[continuum] Creating server.")
            self.server = Server(server_port, self)
        finally:
            sock.close()