Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

io.SocketServer

Aaron Graubert edited this page Sep 18, 2018 · 6 revisions

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.

API
  • 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.