def get_rand_port()

in lumberyard-sample/ci/eks-artifacts/start.py [0:0]


def get_rand_port():
    print 'in get random port'
    # Attempting to get random port
    try:
      s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      print 'socket created'
      s.bind(('',0))
    except socket.error as msg:
      print 'bind failed. Error is '+str(msg[0])+' Msg '+msg[1]
    print 'socket bind complete '
    # Capture the port and release the socket
    port=s.getsockname()[1]
    s.close()
    print 'dynamic port to start the game server is '+str(port)
    return port