module: ‘server_tcp.py’

class gwa.eperf.server_tcp.ServerThread(server_address, RequestHandlerClass, bind_and_activate=True)[source]

Bases: SocketServer.ThreadingMixIn, SocketServer.TCPServer

This class allow to link the class object with an handle function. This handle function is define in the class Connectionprocessing. At each connection with the server, this class create thread and run the same function written in the function handle in the Connectionprocessing.

example

>>> addrTCP=('',port)
>>> server = ServerThread(addrTCP, Connectionprocessing)
>>> SRV_TCP = threading.Thread(target=server.serve_forever)
>>> SRV_TCP.allow_reuse_address=True
>>> SRV_TCP.deamon=False
>>> SRV_TCP.start()

At this moment your server is on idle of connection.

class gwa.eperf.server_tcp.Connectionprocessing(request, client_address, server)[source]

Bases: SocketServer.BaseRequestHandler

This class allow to the connection with the class ServerThread. It define the handle function run by each thread created by each connection with the server.

handle()[source]

Function handle run by each thread or each connection

This function allow to determinate the connection information as the interval or duartion or ID for examples.

And, it’s use to run the function for calculate the bandwidth in mode upload Or / And in mode Download.

gwa.eperf.server_tcp.bandwidthTCPDownload(self, interval, duration, ID)[source]

This function calculate the bandwidth in download between the client and this server.

Argument :
interval (type int)

Determinate the interval in second to calculate the bandwidth.

duration (type float)

Determinate the number of second to run this function.

ID (type int)

Représent the identifaction of connection.

gwa.eperf.server_tcp.bandwidthTCPUpload(self, interval, duration, ID)[source]

This function calculate the bandwidth in upload between the client and this server.

Argument :
interval (type int)

Determinate the interval in second to calculate the bandwidth.

duration (type float)

Determinate the number of second to run this function.

ID (type int)

Représent the identifaction of connection.

Previous topic

module: ‘client_tcp.py’

Next topic

module: ‘client_udp.py’

This Page