Socket server API contract¶
For now, this is an internal API, used by the Pyro Daemon. The various servers in Pyro4.socketserver implement this.
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.COMMTIMEOUTon the sockets (see Pyro4.config — Configuration items). Set
self.sockto 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.
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.
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.
Initiate shutdown of a running socket server, and close it.
Release resources and close a stopped server. It can no longer be used after calling this, until you call initServer again.
This is called to wake up the
requestLoop()if it is in a blocking state.
must be the list of all sockets used by this server (server socket + all connected client sockets)
must be the server socket itself.
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