pymasep.communication.socket_handler

Classes

SocketHandler

Thread used to handle received messages from conn, addr

Module Contents

class pymasep.communication.socket_handler.SocketHandler(conn, addr, logger)

Bases: threading.Thread

Thread used to handle received messages from conn, addr

Parameters:
  • conn – connected socket

  • addr – remote address

  • logger (logging.Logger) – logger used to log send and receive message

lock

lock to send/receive messages one at a time

logger

logger of communication

socket

socket to communicate

addr

remote address

send_queue

message queue for handling multithreading

__del__()

delete the instance. close all sockets

send_frame(frame)

send frame through socket

Parameters:

frame – frame to send

Return type:

None

receive_frame()

wait for receiving frame from socket

Returns:

received frame

Return type:

pymasep.communication.Frame

send_frame_async(frame)

Send a from asynchronously. Use the internal queue and socket as described here: https://stackoverflow.com/questions/51104534/python-socket-receive-send-multi-threading

Parameters:

frame – Frame to send

on_receive(frame)

Callback when a message is received (except for BYE frame).

Parameters:

frame – Frame received

run()

Main thread run that receives and send frames