tlslite.bufferedsocket module

Wrapper around the socket.socket interface that provides buffering

class tlslite.bufferedsocket.BufferedSocket(socket)[source]

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)[source]

Associate socket with the object

close()[source]

Close the underlying socket.

flush()[source]

Send all buffered data

getpeername()[source]

Return the remote address to which the socket is connected

(socket emulation)

getsockname()[source]

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

gettimeout()[source]

Return the timeout associated with socket operations

(socket emulation)

recv(bufsize)[source]

Receive data from socket (socket emulation)

send(data)[source]

Send data to the socket

sendall(data)[source]

Send data to the socket

setsockopt(level, optname, value)[source]

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

settimeout(value)[source]

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

shutdown(how)[source]

Shutdown the underlying socket.