Table of Contents

Module: mockets ./src/peak/util/

Mock Sockets and related types, used for testing socket code

Mockets currently only implement AF_INET and SOCK_STREAM. They also don't support the getsockopt(), setsockopt(), recvfrom(), sendto(), makefile(), or shutdown() operations of real sockets, or the flags argument to send() or recv(). They don't support out of band data, exception conditions, or anything else whose implementation is too platform or protocol-dependent.

Some of these limitations may be lifted later, e.g. SOCK_DGRAM, recvfrom(), and sendto(), if/when we need to test things that use them. We should probably also at least support storing and retrieving options via the getsockopt() and setsockopt() methods, so that tests can verify whether code is setting options that should be set.

Note that real sockets' shutdown() and makefile() behavior is extremely platform-dependent, to the point that we should simply avoid them altogether if possible. In particular, shutdown() on Windows seems to be seriously broken, and makefile() on Windows, RISCOS, and BeOS is emulated with a crude simulation of a file that doesn't support most real file operations.


  • Integrate into for testing un-Twisted selector

Imported modules   
import errno
from weakref import WeakValueDictionary


Emulation of a socket object


A collection of socket objects that can connect to each other


Socket is in blocking mode, and operation would block

Table of Contents

This document was automatically generated on Mon Jun 29 01:11:15 2020 by HappyDoc version 2.1