NCL Library
|
#include <Socket.hpp>
Public Types | |
enum | Mode { BLOCK, ASYNC } |
Public Member Functions | |
virtual | ~CSocket () |
SOCKET | Handle () const |
bool | IsOpen () const |
virtual int | Type () const =0 |
virtual int | Protocol () const =0 |
virtual void | Close () |
size_t | Send (const void *pBuffer, size_t nBufSize) |
size_t | Send (const CBuffer &oBuffer) |
size_t | Recv (void *pBuffer, size_t nBufSize) |
size_t | Recv (CBuffer &oBuffer) |
size_t | Available () |
size_t | Peek (void *pBuffer, size_t nBufSize) |
size_t | Peek (CBuffer &oBuffer, size_t nBufSize) |
void | AddClientListener (IClientSocketListener *pListener) |
void | RemoveClientListener (IClientSocketListener *pListener) |
Static Public Member Functions | |
static bool | IsAddress (const tchar *pszHost) |
static in_addr | Resolve (const tchar *pszHost) |
static CString | ResolveStr (const tchar *pszHost) |
static CString | AsyncEventStr (int nEvent) |
Protected Types | |
typedef std::vector < IClientSocketListener * > | CCltListeners |
The collection of socket event handlers. | |
typedef Core::SharedPtr < CNetBuffer > | NetBufferPtr |
The buffer smart-pointer type. | |
Protected Member Functions | |
CSocket (Mode eMode) | |
CSocket (const CSocket &) | |
void | operator= (const CSocket &) |
void | Create (int nAF, int nType, int nProtocol) |
void | Connect (const tchar *pszHost, uint nPort) |
virtual void | OnAsyncSelect (int nEvent, int nError) |
virtual void | OnReadReady () |
virtual void | OnWriteReady () |
virtual void | OnClosed (int nReason) |
virtual void | OnError (int nEvent, int nError) |
Protected Attributes | |
SOCKET | m_hSocket |
Mode | m_eMode |
CString | m_strHost |
uint | m_nPort |
CCltListeners | m_aoCltListeners |
NetBufferPtr | m_pSendBuffer |
NetBufferPtr | m_pRecvBuffer |
Friends | |
class | CWinSock |
typedef std::vector<IClientSocketListener*> CSocket::CCltListeners [protected] |
The collection of socket event handlers.
Reimplemented in CTCPSvrSocket.
typedef Core::SharedPtr<CNetBuffer> CSocket::NetBufferPtr [protected] |
The buffer smart-pointer type.
enum CSocket::Mode |
CSocket::~CSocket | ( | ) | [virtual] |
CSocket::CSocket | ( | Mode | eMode | ) | [protected] |
CSocket::CSocket | ( | const CSocket & | ) | [protected] |
SOCKET CSocket::Handle | ( | ) | const [inline] |
bool CSocket::IsOpen | ( | ) | const [inline] |
virtual int CSocket::Type | ( | ) | const [pure virtual] |
Implemented in CTCPSocket, and CUDPSocket.
virtual int CSocket::Protocol | ( | ) | const [pure virtual] |
Implemented in CTCPSocket, and CUDPSocket.
void CSocket::Close | ( | ) | [virtual] |
size_t CSocket::Send | ( | const void * | pBuffer, |
size_t | nBufSize | ||
) |
size_t CSocket::Send | ( | const CBuffer & | oBuffer | ) | [inline] |
size_t CSocket::Recv | ( | void * | pBuffer, |
size_t | nBufSize | ||
) |
size_t CSocket::Recv | ( | CBuffer & | oBuffer | ) | [inline] |
size_t CSocket::Available | ( | ) |
size_t CSocket::Peek | ( | void * | pBuffer, |
size_t | nBufSize | ||
) |
size_t CSocket::Peek | ( | CBuffer & | oBuffer, |
size_t | nBufSize | ||
) | [inline] |
bool CSocket::IsAddress | ( | const tchar * | pszHost | ) | [static] |
in_addr CSocket::Resolve | ( | const tchar * | pszHost | ) | [static] |
CString CSocket::ResolveStr | ( | const tchar * | pszHost | ) | [static] |
CString CSocket::AsyncEventStr | ( | int | nEvent | ) | [static] |
void CSocket::AddClientListener | ( | IClientSocketListener * | pListener | ) |
void CSocket::RemoveClientListener | ( | IClientSocketListener * | pListener | ) |
void CSocket::operator= | ( | const CSocket & | ) | [protected] |
void CSocket::Create | ( | int | nAF, |
int | nType, | ||
int | nProtocol | ||
) | [protected] |
void CSocket::Connect | ( | const tchar * | pszHost, |
uint | nPort | ||
) | [protected] |
Reimplemented in CTCPCltSocket, and CUDPCltSocket.
void CSocket::OnAsyncSelect | ( | int | nEvent, |
int | nError | ||
) | [protected, virtual] |
Reimplemented in CTCPSvrSocket.
void CSocket::OnReadReady | ( | ) | [protected, virtual] |
void CSocket::OnWriteReady | ( | ) | [protected, virtual] |
void CSocket::OnClosed | ( | int | nReason | ) | [protected, virtual] |
Reimplemented in CTCPSvrSocket.
void CSocket::OnError | ( | int | nEvent, |
int | nError | ||
) | [protected, virtual] |
Reimplemented in CTCPSvrSocket.
friend class CWinSock [friend] |
SOCKET CSocket::m_hSocket [protected] |
Mode CSocket::m_eMode [protected] |
CString CSocket::m_strHost [protected] |
uint CSocket::m_nPort [protected] |
CCltListeners CSocket::m_aoCltListeners [protected] |
NetBufferPtr CSocket::m_pSendBuffer [protected] |
NetBufferPtr CSocket::m_pRecvBuffer [protected] |