The server module

The server module contains the Server class which provides the ability to create a thread which acts as a server and allows data to be sent and received from various connections.

The Server class

Inheritance diagram of pyamp.networking.sockets.server.Server

class pyamp.networking.sockets.server.Server(connectionClass, port, host='', logger=None)[source]

The Server class handles creating a server on a specific host and port. It also handles multiple connections to the server while being able to receive data from any of those connections.

This class implements the pyamp.processes.Thread and pyamp.logging.Loggable interfaces.

  • connectionClass – The class used to handle each connection
  • port – The server port number
  • host – The server host
  • logger – The LogData or Logger for this class
closeConnection(addr)[source]

Close an open connection.

  • addr – The address for the connection to close
onCycle(_i)[source]

Called for every cycle of the pyamp.processes.Thread.

  • i – The current cycle number
onReceive(addr, data)[source]

Called in the event that data is received.

  • addr – The address of the connection where the data originated
  • data – The data that was received
onShutdown()[source]

Called in the event that the pyamp.processes.Thread is shutdown.

onStart()[source]

Called when the pyamp.processes.Thread is started.

openConnection(conn, addr)[source]

Handle the newly opened connection.

  • conn – The socket object for the connection
  • addr – The address for the connection

Table Of Contents

Previous topic

The connection module

Next topic

The config module

This Page