6.17. foundations.tcpServer

tcpServer.py

Platform:
Windows, Linux, Mac Os X.
Description:
This module defines the TCPServer class and other helpers objects needed to run a Python socket server.

Others:

6.17.1. Module Attributes

foundations.tcpServer.LOGGER

6.17.2. Classes

class foundations.tcpServer.EchoRequestsHandler(request, client_address, server)[source]

Bases: SocketServer.BaseRequestHandler

This class is the default echo requests handler.

handle()[source]

This method reimplements the SocketServer.BaseRequestHandler.handle() method.

Returns:Method success. ( Boolean )
class foundations.tcpServer.TCPServer(address, port, handler=<class foundations.tcpServer.EchoRequestsHandler at 0x1022ee0b8>)[source]

Bases: object

This class defines a TCP server.

Usage:

>>> tcpServer = TCPServer("127.0.0.1", 16384)
>>> tcpServer.start()
True
>>> tcpServer.stop()
True
Parameters:
  • address – Server address. ( String )
  • port – Server port list. ( Integer )
  • handler – Request handler. ( SocketServer.BaseRequestHandler )
address[source]

This method is the property for self.__address attribute.

Returns:self.__address. ( String )
port[source]

This method is the property for self.__port attribute.

Returns:self.__port. ( Integer )
handler[source]

This method is the property for self.__handler attribute.

Returns:self.__handler. ( String )
online[source]

This method is the property for self.__online attribute.

Returns:self.__online. ( String )
start()[source]

This method starts the TCP server.

Returns:Method success. ( Boolean )
stop(terminate=False)[source]

This method stops the TCP server.

Returns:Method success. ( Boolean )

Table Of Contents

Previous topic

6.16. foundations.strings

Next topic

6.18. foundations.trace

This Page