|
| Socket (void) |
| Constructor. More...
|
|
| Socket (Poison *pPoison) |
| Construct a socket with the given poison. More...
|
|
virtual void | openStream (Transport transport=e_tcp, BWORD server=FALSE) |
| Wraps bsd socket(AF_INET, SOCK_STREAM, 0) call. More...
|
|
virtual SockHandle | socket (int domain, int type, int protocol) |
| Wraps bsd socket() call. More...
|
|
virtual void | bind (SockAddr &sockaddr) |
| Wraps bsd bind() call. More...
|
|
virtual void | listen (int backlog) |
| Wraps bsd listen() call. More...
|
|
virtual sp< Socket > | accept (SockAddr &sockaddr) |
| Wraps bsd accept() call. More...
|
|
virtual void | connect (SockAddr &sockaddr) |
| Wraps bsd connect() call. More...
|
|
virtual IWORD | read (const void *pBuffer, IWORD count, ReadMode readMode=e_readNormal) |
| Wraps bsd recv() call. More...
|
|
virtual IWORD | write (const void *pBuffer, IWORD count) |
| Wraps bsd send() call. More...
|
|
virtual void | setPoison (Poison *pPoison) |
| Set a Poison object. More...
|
|
virtual void | wait (void) |
| Wait for the socket to be readable (via select), checking at a regular interval for Poison to be active. More...
|
|
virtual void | close (void) |
| Close the underlying socket. More...
|
|
virtual bool | isOpen (void) |
| Return true if the socket is open, otherwise return false. More...
|
|
virtual U32 | id (void) |
| Return a network identifier unique among Sockets connected to the same accept()ing 'server' Socket. More...
|
|
SockHandle | sockHandle () const |
|
Transport | transportType () const |
|
SockAddr | sockAddrOwn () const |
|
virtual void | acquire (void) |
| Increment the reference count. More...
|
|
virtual void | acquire (int &rCount) |
| Increment the reference count (and get the count) More...
|
|
virtual void | release (void) |
| Decrement the reference count. More...
|
|
virtual void | abandon (void) |
| Decrement the reference count. More...
|
|
int | count (void) const |
| Return the count of references. More...
|
|
void | setName (const String &) |
|
void | trackReference (void *pReference, String what) |
|
void | untrackReference (void *pReference) |
|
void | registerRegion (void *pT, U32 bytes) |
|
A socket wrapper.
The premise of this wrapper is to be simple and to the point. Flexibility and extensibility are not explicitly considered. The intent is that all network communication will go through class and does not care about TCP/IP details.
A concept of thread poison is supported by this class due to the blocking calls (accept, read, connect). If Poison is associated with the Socket, then blocking calls will be aborted if the Poison becomes active before the calls can return normally. If this happens then a Poisoned exception is thrown.
A concept of network identifier is also supported by this class to provide a notion of site uniqueness in a networked application. It is implemented in this lower level abstraction to assure simplicity in maintaining uniqueness. A socket's unique id is 0 until it does a connect() in which case it will be given a unique id from the other side of the connection (presumably a 'server').