-
Notifications
You must be signed in to change notification settings - Fork 0
io.SocketServer
The agutil.io
module includes the class SocketServer
.
SocketServer
instances provide a simple interface to listen for and accept incoming connections as Socket
objects.
-
SocketServer(port, address='', queue=3) (constructor) Begins listening for connections on port. If address is specified, only connections to that specific address will be accepted (in the case for systems with multiple addresses). queue defines how many incoming connections will be queued to be accepted before new connections are rejected
-
SocketServer.accept(socket_type=
agutil.io.Socket
, **kwargs):Blocks until an incoming connection is established, then returns an object for the incoming connection of type socket_type. The type defaults to
agutil.io.Socket
. Any kwargs are sent to the constructor of the returned socket. -
SocketServer.close() Closes and unbinds the socket. Note that the underlying TCP connection will linger for a few seconds before closing.