socktools.tcp_linemode_mixin - line by line support for TCP servers

This module enables reading from TCP sockets line by line, it is used by the example simple_chat.py

class socktools.tcp_linemode_mixin.TCPLinemodeMixin[source]

Bases: object

A mixin for implementing line protocols

When implementing line-based protocols over TCP, use this mixin

do_real_read(s)[source]

Read messages from a socket by reading lines

Parameters:s (socket.socket) – the underlying physical socket to read from
Returns:a single line read from that socket
Return type:str
encode_msg(data)[source]

Identity function

Since we don’t need a length prefix when in line-by-line mode this method is just an identity function

Parameters:data (str) – The raw message
Returns:The raw message
Return type:str