Package tlslite :: Module recordlayer :: Class RecordSocket
[hide private]
[frames] | no frames]

Class RecordSocket

source code


Socket wrapper for reading and writing TLS Records

Instance Methods [hide private]
 
__init__(self, sock)
Assign socket to wrapper
source code
 
_recvHeader(self)
Read a single record header from socket
source code
generator
_sockRecvAll(self, length)
Read exactly the amount of bytes specified in length from raw socket.
source code
 
_sockSendAll(self, data)
Send all data through socket
source code
generator
recv(self)
Read a single record from socket, handle SSLv2 and SSLv3 record layer
source code
 
send(self, msg, padding=0)
Send the message through socket.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, sock)
(Constructor)

source code 

Assign socket to wrapper

Parameters:
  • sock (socket.socket)
Overrides: object.__init__

_sockRecvAll(self, length)

source code 

Read exactly the amount of bytes specified in length from raw socket.

Returns: generator
generator that will return 0 or 1 in case the socket is non blocking and would block and bytearray in case the read finished
Raises:

_sockSendAll(self, data)

source code 

Send all data through socket

Parameters:
  • data (bytearray) - data to send
Raises:
  • socket.error - when write to socket failed

recv(self)

source code 

Read a single record from socket, handle SSLv2 and SSLv3 record layer

Returns: generator
generator that returns 0 or 1 in case the read would be blocking or a tuple containing record header (object) and record data (bytearray) read from socket
Raises:

send(self, msg, padding=0)

source code 

Send the message through socket.

Parameters:
  • msg (bytearray) - TLS message to send
  • padding (int) - amount of padding to specify for SSLv2
Raises:
  • socket.error - when write to socket failed