|
Public Member Functions |
|
| CWinSocket () |
| | Default Constructor.
|
| virtual | ~CWinSocket () |
| | Destructor.
|
|
void | Destroy () |
| | Closes the socket and releases related resources.
|
| BOOL | Attach (SOCKET hSocket) |
| | Attaches to existing socket handle.
|
|
void | Detach () |
| | Detaches from existing socket handle without releasing it.
|
|
BOOL | IsSocket () |
| | Returns non-zero if the class contains a valid socket handle.
|
|
SOCKET | GetSocketHandle () |
| | Returns a handle to the socket.
|
|
| operator SOCKET () |
| | Returns a handle to the socket.
|
| virtual BOOL | Create (int af=AF_INET, int type=SOCK_STREAM, int protocol=0) |
| | Creates a new socket handle.
|
|
UINT | GetLastError () |
| | Returns the most recent error code.
|
| LPCTSTR | GetLastErrorStr (LPSTR pStr, LPCTSTR pTemplate=NULL) |
| | Returns a string describing the last error.
|
| BOOL | Bind (UINT uPort) |
| | Binds the open socket to the specified Port.
|
| BOOL | Listen (UINT uMaxConnections=32) |
| | Creates a socket listening on the bound port.
|
| virtual BOOL | Connect (sockaddr_in *pSa, UINT uSize=sizeof(SOCKADDR)) |
| | Connects to the specified address.
|
| BOOL | Connect (LPCTSTR pAddress, UINT uPort) |
| | Address of remote peer.
|
| BOOL | GetHostByName (LPCTSTR pHost, LPHOSTENT *pHe, UINT *puPort=NULL) |
| | Gets host address information from DNS server.
|
| BOOL | EventSelect (WSAEVENT hEvent, long lEvents=FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_CLOSE) |
| | Selects which events will generate callbacks.
|
| BOOL | EventSelect (long lEvents=FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_CLOSE) |
| | Selects which events will generate callbacks.
|
|
HANDLE | GetEventHandle () |
| | Retuns the current event handle.
|
|
BOOL | IsEventHandle () |
| | Returns non-zero if there is a valid event handle.
|
|
BOOL | CreateEventHandle () |
| | Creates a network event handle.
|
|
void | CloseEventHandle () |
| | Closes the event handle.
|
| BOOL | WaitEvent (WSAEVENT hEvent, long lEventId=0xffffffff, LPWSANETWORKEVENTS pWne=NULL, UINT uTimeout=INFINITE) |
| | Waits for a socket event to occur.
|
| BOOL | WaitEvent (long lEventId=0xffffffff, LPWSANETWORKEVENTS pWne=NULL, UINT uTimeout=INFINITE) |
| | Waits for a socket event to occur.
|
| UINT | GetEventBit (long lEventMask) |
| | Returns the bit offset for the specified event.
|
| UINT | Recv (LPVOID pData, UINT uSize, UINT *puRead=NULL, UINT uFlags=0) |
| | Reads data from the socket.
|
| UINT | Send (const LPVOID pData, UINT uSize, UINT *puSent=NULL, UINT uFlags=0) |
| | Writes data to the socket.
|
| UINT | Send (LPCTSTR pStr, UINT *puSent=NULL, UINT uFlags=0) |
| | Writes a NULL terminated string to the socket.
|
| BOOL | GetPeerName (LPSTR pName, LPDWORD pdwPort=NULL) |
| | Gets the remote socket information.
|
| BOOL | GetSocketName (LPSTR pName, LPDWORD pdwPort=NULL) |
| | Gets the local socket information.
|
| BOOL | IoCtlSocket (long cmd, LPDWORD pdw) |
| | Controls the i/o mode of the socket.
|
| BOOL | IoCtl (DWORD code, LPVOID pInbuf=NULL, DWORD dwInbuf=0, LPVOID pOutbuf=NULL, DWORD dwOutbuf=0, LPDWORD pBytesReturned=NULL) |
| | Controls Socket2 mode features of the socket.
|
| BOOL | EnableCircularQueueing () |
| | Enables circular queueing.
|
| BOOL | FindRoute (LPSOCKADDR psa) |
| | Finds the route to the specified address.
|
| BOOL | Flush () |
| | Flushes the socket data queue.
|
| BOOL | GetBroadcastAddress (LPSOCKADDR psa) |
| | Receives the current broadcast address.
|
| BOOL | GetQOS (LPQOS pqos) |
| | Returns current quality of service information.
|
| BOOL | GetGroupQOS (LPQOS pqos) |
| | Returns current quality of service information.
|
| BOOL | SetMultipointLoopback (BOOL bLoopback) |
| | Enables / disables multi-point loopback.
|
| BOOL | SetMultipointScope (DWORD scope) |
| | Sets multipoint scope.
|
| BOOL | SetQOS (LPQOS pqos) |
| | Sets quality of service information.
|
| BOOL | SetGroupQOS (LPQOS pqos) |
| | Sets group quality of service information.
|
| BOOL | SetSendBufferSize (DWORD size) |
| | Sets the send buffer size on the socket.
|
| BOOL | SetRecvBufferSize (DWORD size) |
| | Sets the receive buffer size on the socket.
|
Static Public Member Functions |
| static BOOL | InitSockets (WORD ver=eMinSocketVersion) |
| | Initializes the Windows Socket API.
|
|
static void | UninitSockets () |
| | Uninitializes the Windows Socket API.
|
|
static BOOL | IsInitialized () |
| | Returns non-zero if the Windows Socket API was successfully initialized.
|
For most advanced applications, you will probably want the asynchronous capability of TWinAsyncSocket.