SockUtil Class Reference
[Utils]

#include <SockUtil.h>

List of all members.


Detailed Description

helper methods for dealing with sockets. Use instead of direct methods for portability.

Definition at line 53 of file SockUtil.h.


Static Public Member Functions

static void init ()
 automatically called. Added for WinSock, which needs to be initialized
static void setNonblock (socket_t s)
 Make socket s be non-blocking.
static void fillSockAddr (const std::string &host, uint16_t port, struct sockaddr_in &sa) throw (AddressException)
 fill contents of the sockaddr_in from the host and port
static void fillSockAddr (uint32_t addr, uint16_t port, struct sockaddr_in &sa)
 fill contents of the sockaddr_in from the addr and port
static void fillSockAddr (const SockAddr &addr, struct sockaddr_in &sa)
 fill a sockaddr_in from a SockAddr
static SockAddr getSockAddr (const std::string &hostname) throw (AddressException)
 return a SockAddr from a hostname
static int getErrno ()
 Use instead of the variable "errno".
static bool errorWouldBlock (int err=-1)
 Check of the err (or getErrno()) is because call would block (EAGAIN, EWOULDBLOCK, EINTR, or EINPROGRESS).
static bool errorInterrupted (int err=-1)
 Check if the err (or getErrno()) is interrupted (EINTR).
static bool errorBadF (int err=-1)
 Check if the err (or getErrno()) is a bad file descriptor (EBADF).
static bool errorConnFail (int err=-1)
 Check if the err (or getErrno()) is a connection failure (ECONNABORTED or EPROTO).
static bool errorTransient (int err=-1)
 Check if the err (or getErrno()) is a transient system error (ENFILE, EMFILE, ENOBUFS, ENOMEM).
static bool errorNotConnected (int err=-1)
 Check if the err (or getErrno()) is not connected (ENOTCONN or EINVAL).

Static Public Attributes

static const SockAddr NULL_MSOCKADDR = SockAddr()
 convenience object for a "null" SockAddr
static const MaceAddr NULL_MACEADDR = MaceAddr()
 convenience object for a "null" MaceAddr
static const std::string NAT_STRING = "(NAT)"
 reference "NAT" string (presently "(NAT)"

The documentation for this class was generated from the following files:

Generated on Sat Oct 4 21:30:30 2008 for Mace Library by  doxygen 1.5.5