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.
TODO
|