class documentation

class FakeSocket: (source)

View In Hierarchy

A fake for socket.socket objects.

Method __init__ Undocumented
Method close Close is not implemented. The method is provided since real sockets have it and some code expects it. No behavior of FakeSocket is affected by a call to it.
Method fileno Return a fake file descriptor. If actually used, this will have no connection to this FakeSocket and will probably cause surprising results.
Method recv Undocumented
Method send Send all of bytes by accumulating it into self.sendBuffer.
Method setblocking Undocumented
Method setsockopt Setsockopt is not implemented. The method is provided since real sockets have it and some code expects it. No behavior of FakeSocket is affected by a call to it.
Method shutdown Shutdown is not implemented. The method is provided since real sockets have it and some code expects it. No behavior of FakeSocket is affected by a call to it.
Instance Variable blocking Undocumented
Instance Variable data A str giving the data which will be returned from FakeSocket.recv.
Instance Variable sendBuffer A list of the objects passed to FakeSocket.send.
def __init__(self, data): (source)

Undocumented

def close(self): (source)

Close is not implemented. The method is provided since real sockets have it and some code expects it. No behavior of FakeSocket is affected by a call to it.

def fileno(self): (source)

Return a fake file descriptor. If actually used, this will have no connection to this FakeSocket and will probably cause surprising results.

def recv(self, size): (source)

Undocumented

def send(self, bytes): (source)

Send all of bytes by accumulating it into self.sendBuffer.

Returns
The length of bytes, indicating all the data has been accepted.
def setblocking(self, blocking): (source)

Undocumented

def setsockopt(self, *args): (source)

Setsockopt is not implemented. The method is provided since real sockets have it and some code expects it. No behavior of FakeSocket is affected by a call to it.

def shutdown(self, how): (source)

Shutdown is not implemented. The method is provided since real sockets have it and some code expects it. No behavior of FakeSocket is affected by a call to it.

blocking = (source)

Undocumented

A str giving the data which will be returned from FakeSocket.recv.

sendBuffer: list = (source)

A list of the objects passed to FakeSocket.send.