def setup_server(port=0, verbose=False):
 host = gethostname()
 sock = socket(AF_INET, SOCK_STREAM)
 try:
  sock.bind((host, port))
 except error as msg:
  raise error(('Could not open Socket on server: ' + str(msg)))
 sock.listen(5)
 if verbose:
  print ('Server listening on %s' % str(sock.getsockname()))
 return sock

def setup_server ( port = 0 , verbose = False ) : host = gethostname ( ) sock = socket ( AF_INET , SOCK_STREAM ) try : sock . bind ( ( host , port ) ) except error as msg : raise error ( ( 'Could not open Socket on server: ' + str ( msg ) ) ) sock . listen ( 5 ) if verbose : print ( 'Server listening on %s' % str ( sock . getsockname ( ) ) ) return sock
sets up and starts/restarts the web service .