Socket server API contract

For now, this is an internal API, used by the Pyro Daemon. The various servers in Pyro5.socketserver implement this.

class SocketServer_API

Methods:

init(daemon, host, port, unixsocket=None)

Must bind the server on the given host and port (can be None). daemon is the object that will receive Pyro invocation calls (see below). When host or port is None, the server can select something appropriate itself. If possible, use Pyro4.config.COMMTIMEOUT on the sockets (see Pyro5.config — Configuration items). Set self.sock to the daemon server socket. If unixsocket is given the name of a Unix domain socket, that type of socket will be created instead of a regular tcp/ip socket.

loop(loopCondition)

Start an endless loop that serves Pyro requests. loopCondition is an optional function that is called every iteration, if it returns False, the loop is terminated and this method returns.

events(eventsockets)

Called from external event loops: let the server handle events that occur on one of the sockets of this server. eventsockets is a sequence of all the sockets for which an event occurred.

shutdown()

Initiate shutdown of a running socket server, and close it.

close()

Release resources and close a stopped server. It can no longer be used after calling this, until you call initServer again.

wakeup()

This is called to wake up the requestLoop() if it is in a blocking state.

Properties:

sockets

must be the list of all sockets used by this server (server socket + all connected client sockets)

sock

must be the server socket itself.

locationStr

must be a string of the form "serverhostname:serverport" can be different from the host:port arguments passed to initServer. because either of those can be None and the server will choose something appropriate. If the socket is a Unix domain socket, it should be of the form "./u:socketname".