コード例 #1
0
ファイル: serial.py プロジェクト: wxy2933/nova
def _verify_port(host, port):
    s = socket.socket()
    try:
        s.bind((host, port))
    except socket.error as e:
        raise exception.SocketPortInUseException(host=host, port=port, error=e)
    finally:
        s.close()
コード例 #2
0
def _verify_port(host, port):
    af = socket.AF_INET6 if ":" in host else socket.AF_INET
    s = socket.socket(af)
    try:
        s.bind((host, port))
    except socket.error as e:
        raise exception.SocketPortInUseException(host=host, port=port, error=e)
    finally:
        s.close()
コード例 #3
0
 def port_10000_already_used(host, port):
     if port == 10000 and host == '127.0.0.1':
         raise exception.SocketPortInUseException(
             port=port, host=host, error="already in use")