Public Types | |
typedef char | TimeToLive |
Public Member Functions | |
CSocket () | |
Create an object that isn't attached to a SOCKET, you'll need to call Attach() before you can call any of the socket functions. | |
CSocket (SOCKET theSocket) | |
Creates an object that is attached to the supplied SOCKET. The object takes ownership of the SOCKET and will call AbortiveClose() on it when destroyed. | |
CSocket (const CSocket &rhs) | |
~CSocket () | |
CSocket & | operator= (const CSocket &rhs) |
void | Attach (SOCKET theSocket) |
Attaches the supplied SOCKET to the object. The object takes ownership of the SOCKET and will call AbortiveClose() on it when destroyed. | |
SOCKET | GetSocket () const |
SOCKET | Detach () |
Passes ownership of the SOCKET to the caller. | |
void | Close () |
Issues a lingering close. | |
void | AbortiveClose () |
Issues a non-lingering close, data may be lost. | |
void | Shutdown (int how) |
Shut the connection down. | |
void | Listen (ListenBacklog backlog) |
Set the socket into listening state with a pending connection queue of the specified size. | |
void | Bind (const IAddress &address) |
Bind the socket to the supplied local address. | |
DWORD | TryBind (const IAddress &address) |
Bind the socket to the supplied local address. | |
void | Connect (const IAddress &address) |
Connects the socket to the given address. Throws an exception on failure. | |
bool | ConnectNoThrow (const IAddress &address) |
Attempts to connect the socket to the given address. Returns false on failure. | |
void | SetReadTimeout (DWORD timeout) |
void | Read (BYTE *pBuffer, DWORD bufferSize, DWORD &bytesRead) |
Performs a synchronous read on the socket. | |
void | Write (const BYTE *pData, DWORD dataLength) |
Performs a synchronous write on the socket. | |
CAddress | GetLocalAddress () const |
CAddress | GetRemoteAddress () const |
bool | IsValid () const |
Returns true if the object is attached to a valid SOCKET. | |
Static Public Member Functions | |
static void | Connect (SOCKET socket, const IAddress &address) |
Connects the supplied socket to the given address. Throws an exception on failure. | |
static bool | ConnectNoThrow (SOCKET socket, const IAddress &address) |
Attempts to connect the supplied socket to the given address. Returns false on failure. | |
static CAddress | GetLocalAddress (SOCKET socket) |
static CAddress | GetRemoteAddress (SOCKET socket) |
static void | JoinMulticastGroup (SOCKET socket, const IAddress &groupAddress, const IAddress &interfaceAddress) |
static void | BlockMulticastGroupSource (SOCKET socket, const IAddress &groupAddress, const IAddress &interfaceAddress, const IAddress &sourceAddress) |
static void | UnblockMulticastGroupSource (SOCKET socket, const IAddress &groupAddress, const IAddress &interfaceAddress, const IAddress &sourceAddress) |
static void | LeaveMulticastGroup (SOCKET socket, const IAddress &groupAddress, const IAddress &interfaceAddress) |
static void | IncludeMulticastSource (SOCKET socket, const IAddress &groupAddress, const IAddress &interfaceAddress, const IAddress &sourceAddress) |
static void | ExcludeMulticastSource (SOCKET socket, const IAddress &groupAddress, const IAddress &interfaceAddress, const IAddress &sourceAddress) |
static void | SetMulticastSendInterface (SOCKET socket, const IAddress &interfaceAddress, TimeToLive multicastTTL, bool enableLoopback) |
typedef char TimeToLive |
CSocket | ( | ) |
Create an object that isn't attached to a SOCKET, you'll need to call Attach() before you can call any of the socket functions.
Creates an object that is attached to the supplied SOCKET. The object takes ownership of the SOCKET and will call AbortiveClose() on it when destroyed.
~CSocket | ( | ) |
void Attach | ( | SOCKET | theSocket | ) |
Attaches the supplied SOCKET to the object. The object takes ownership of the SOCKET and will call AbortiveClose() on it when destroyed.
SOCKET GetSocket | ( | ) | const |
SOCKET Detach | ( | ) |
Passes ownership of the SOCKET to the caller.
void Close | ( | ) |
Issues a lingering close.
void AbortiveClose | ( | ) |
Issues a non-lingering close, data may be lost.
void Shutdown | ( | int | how | ) |
Shut the connection down.
void Listen | ( | ListenBacklog | backlog | ) |
Set the socket into listening state with a pending connection queue of the specified size.
void Bind | ( | const IAddress & | address | ) |
Bind the socket to the supplied local address.
void Connect | ( | const IAddress & | address | ) |
Connects the socket to the given address. Throws an exception on failure.
Connects the supplied socket to the given address. Throws an exception on failure.
Attempts to connect the socket to the given address. Returns false on failure.
Attempts to connect the supplied socket to the given address. Returns false on failure.
void SetReadTimeout | ( | DWORD | timeout | ) |
Performs a synchronous read on the socket.
CAddress GetLocalAddress | ( | ) | const |
CAddress GetRemoteAddress | ( | ) | const |
bool IsValid | ( | ) | const |
Returns true if the object is attached to a valid SOCKET.
void JoinMulticastGroup | ( | SOCKET | socket, | |
const IAddress & | groupAddress, | |||
const IAddress & | interfaceAddress | |||
) | [static] |
void BlockMulticastGroupSource | ( | SOCKET | socket, | |
const IAddress & | groupAddress, | |||
const IAddress & | interfaceAddress, | |||
const IAddress & | sourceAddress | |||
) | [static] |
void UnblockMulticastGroupSource | ( | SOCKET | socket, | |
const IAddress & | groupAddress, | |||
const IAddress & | interfaceAddress, | |||
const IAddress & | sourceAddress | |||
) | [static] |
void LeaveMulticastGroup | ( | SOCKET | socket, | |
const IAddress & | groupAddress, | |||
const IAddress & | interfaceAddress | |||
) | [static] |
void IncludeMulticastSource | ( | SOCKET | socket, | |
const IAddress & | groupAddress, | |||
const IAddress & | interfaceAddress, | |||
const IAddress & | sourceAddress | |||
) | [static] |
void ExcludeMulticastSource | ( | SOCKET | socket, | |
const IAddress & | groupAddress, | |||
const IAddress & | interfaceAddress, | |||
const IAddress & | sourceAddress | |||
) | [static] |
void SetMulticastSendInterface | ( | SOCKET | socket, | |
const IAddress & | interfaceAddress, | |||
TimeToLive | multicastTTL, | |||
bool | enableLoopback | |||
) | [static] |