Added some more tests, and supporting code.

Exported some missing constants.
Return values from bind(), connect(), send(), close().
Implement getsockopt(), setsockopt(), shutdown().