#include <mcllib/MCSocket.h>
Inheritance diagram for MCSocket:
Public Member Functions | |
void | bind (const MCNetAddr &addr) |
Bind a socket to a local address. | |
bool | getNonBlock () const |
Determine if socket is non-blocking. | |
mcuint32 | getRecvBufferSize () const |
Get the size of the receive buffer. | |
bool | getReuseAddr () const |
Determine if the socket address can be reused at bind time. | |
mcuint32 | getSendBufferSize () const |
Get the size of the send buffer. | |
MCNetAddr | getSockName () const |
Get the local address of the socket. | |
mcuint32 | getTos () const |
Get the type of service of the socket. | |
mcuint32 | getTtl () const |
Get the time-to-live of the soket. | |
MCRecvFromResult | recvFrom (void *buf, mcint32 len, mcinterval_t timeout=MCIntervalInfinite) |
Receive data from a peer. | |
mcint32 | sendTo (const MCNetAddr &addr, const void *buf, mcint32 len, mcinterval_t timeout=MCIntervalInfinite) |
Send data to a peer. | |
void | setNonBlock (bool nonBlock) |
Set the blocking state of the socket. | |
void | setRecvBufferSize (mcuint32 sz) |
Set the receive buffer size. | |
void | setReuseAddr (bool reuse) |
Set the socket to allow or disallow resuse of an address during bind. | |
void | setSendBufferSize (mcuint32 sz) |
Set the send buffer size. | |
void | setTos (mcuint32 tos) |
Set the type of service. | |
void | setTtl (mcuint32 ttl) |
Set the time to live. | |
~MCSocket () | |
Close the socket and free resources. | |
Protected Member Functions | |
MCSocket (void *impl) | |
Construct from an implementation. | |
MCSocket () | |
Default constructor for use by derived classes. |
Sockets allow intra-system and inter-system IPC. A socket forms one end of a communication path. An address is used to determine what the other end of the communication path is.
|
Close the socket and free resources. This does not perform a shutdown() first. |
|
Construct from an implementation. The implementation object must be derived from MCSockBaseImpl |
|
Bind a socket to a local address. If the address cannot be bound an exception is thrown.
|
|
Determine if socket is non-blocking. If the socket is non-blocking, send and receive operations will throw an exception if the operation would block.
|
|
Get the size of the receive buffer.
|
|
Determine if the socket address can be reused at bind time. If the socket address cannot be re-used, a bind() against an address which is already in use will fail. Because sockets may linger in the system after they are closed, or if they were not closed properly, it may be necessary to force re-use of an existing address.
|
|
Get the size of the send buffer.
|
|
Get the local address of the socket. The socket must be bound. If the socket name cannot be obtained an exception is thrown.
|
|
Get the type of service of the socket.
|
|
Get the time-to-live of the soket.
|
|
Receive data from a peer. If the receive fails an exception is thrown.
|
|
Send data to a peer. If the send fails an exception is thrown.
|
|
Set the blocking state of the socket.
|
|
Set the receive buffer size.
|
|
Set the socket to allow or disallow resuse of an address during bind.
|
|
Set the send buffer size.
|
|
Set the type of service.
|
|
Set the time to live.
|