The IYISocket defines the interface to be implemented by any class fulfilling sockets services.
IYISocket is one end of an interprocess communication channel. The user of this interface is responsible for making sure that connections are established before used and the channel is properly closed when finished.
#include <network/YiSocket.h>

Public Types | |
| enum | SOCKET_RESULT { YI_SOCKET_SUCCESS, YI_SOCKET_ERROR, YI_SOCKET_NOT_CONNECTED, YI_SOCKET_CLOSE, YI_SOCKET_WOULD_BLOCK } |
| Possible return values from socket operations. More... | |
Public Member Functions | |
| virtual | ~IYISocket () |
| virtual bool | Connect ()=0 |
| virtual bool | Disconnect ()=0 |
| virtual bool | IsConnected () const =0 |
| virtual SOCKET_RESULT | Send (const char *pBuffer, size_t uLength)=0 |
| virtual SOCKET_RESULT | Send (const char *pBuffer, size_t uLength, size_t &uSent)=0 |
| virtual SOCKET_RESULT | Receive (char *pBuffer, size_t uLength, size_t &uReceived)=0 |
| virtual uint64_t | GetTotalBytesSent () const =0 |
| virtual uint64_t | GetTotalBytesReceived () const =0 |
| virtual void | SetConnectionTimeoutMs (uint32_t uTimeoutMs)=0 |
| virtual uint32_t | GetConnectionTimeoutMs () const =0 |
| virtual bool | SetSocketBlockingEnabled (bool bBlocking)=0 |
Static Public Member Functions | |
| static bool | SOCKET_OPERATION_SUCCEEDED (SOCKET_RESULT eResult) |
|
inlinevirtual |
|
pure virtual |
Initiates a connection based on the socket's address and configuration. Returns true if successful.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Closes the connection on the socket. Returns true if successful.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Returns the timeout length in milliseconds.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Returns the total number of bytes received during the lifetime of the socket.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Returns the total number of bytes sent during the lifetime of the socket.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Returns true if the socket is connected.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Receives a character buffer, pBuffer from a socket, passing in the length,nLength, of the buffer. nReceived is an output parameter representing the number of bytes successfully received. Returns SOCKET_RESULT to indicate socket operation result.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Sends a character buffer, pBuffer along with the buffer length, nLength, to the socket. Returns SOCKET_RESULT to indicate socket operation result.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Sends a character buffer, pBuffer along with the buffer length, nLength, to the socket. nSent is an output parameter representing the number of bytes that were successfully sent. Returns SOCKET_RESULT to indicate socket operation result.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Sets the length of time in milliseconds uTimeoutMs that the socket will wait for a connection before aborting the Connect() operation. The default timeout is set to 10 seconds (10000 ms).
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
pure virtual |
Utility method modifying the socket's internal flags base on bBlocking. When bBlocking is true, further calls to Send(), Receive(), Connect() and Accept() on the socket will block until a response is received. The default state when a socket is created is blocking. Returns true if the call succeeded.
Implemented in CYITCPSocket, and CYITCPSecureSocket.
|
inlinestatic |
Utility method to check return value of socket operation