tlslite.bufferedsocket module

Wrapper around the socket.socket interface that provides buffering

class tlslite.bufferedsocket.BufferedSocket(socket)

Bases: object

Socket that will buffer reads and writes to a real socket object

When buffer_writes is enabled, writes won’t be passed to the real socket until flush() is called.

Not multithread safe.

Variables:buffer_writes (boolean) – whether to buffer data writes, False by default
__init__(socket)

Associate socket with the object

close()

Close the underlying socket.

flush()

Send all buffered data

getpeername()

Return the remote address to which the socket is connected

(socket emulation)

getsockname()

Return the socket’s own address (socket emulation).

gettimeout()

Return the timeout associated with socket operations

(socket emulation)

recv(bufsize)

Receive data from socket (socket emulation)

send(data)

Send data to the socket

sendall(data)

Send data to the socket

setsockopt(level, optname, value)

Set the value of the given socket option (socket emulation).

settimeout(value)

Set a timeout on blocking socket operations (socket emulation).

shutdown(how)

Shutdown the underlying socket.