# the module server

The file `server` defines a simple client/server interaction to solve many random trinomials.

## functions in the module server

The module server.py exports routines to send and receive lists of strings through sockets. These strings represent either polynomials or solutions as data interchanges between a client and a server. A simple illustration of the use of server is to solve many polynomial systems over a client/server network. The interactive main program starts up a multithreaded server. The server generates a list of random polynomial systems which are distributed among clients in a static scheme. The clients solve the polynomial systems and send solutions to the server.

class server.ServerHandler(n, s, m, problems)

  Defines the action of the handler threads, using static workload balancing.

  run()

    Each handler accepts a connection from a client. Thread k send those problems in the list L whose index modulo the number of threads is k.

server.client()

  The client connects to a server and solves a system.

server.main()

  Launches one server and clients on the same computer.

server.recv_strings(sock, bufsize)

  A list of strings is received via the socket sock using buffer size bufsize. First the number of strings is received, before the strings. On return is the list of strings.

server.send_strings(sock, bufsize, items)

  A list of strings in items will be sent via the socket sock using buffer size bufsize. First the number of strings is sent, followed by the strings in items.

server.server_connect(nbclients, bufsize, portnum)

  Connects a server to listen to nbclients clients, using buffer size bufsize and port number p. Returns the socket to connect clients.

server.solve_system(pols)

  Calls the black box solver of PHCpack for valid input lists pols. Returns the solution found.

server.start_server(systems, nbclients)

  The server has a list of systems in systems for nbclients clients to solve.