#include "ktypes.h"
Defines | |
| #define | KSocket_new() _KSocket_new (__K_FILE__, __K_LINE__) |
| Allocates a KSocket structure. | |
| #define | KSocket_waitStatus(pSocket, eStatus) _KSocket_waitStatus (pSocket, eStatus, __K_FILE__, __K_LINE__) |
| Waits that a socket reaches a particular state. In disconnection cases, the following code is returned "KSOK_RET_DISCONNECTED". This function is blocking. | |
| #define | KSocket_waitStatusForTime(pSocket, eStatus, imsec) _KSocket_waitStatusForTime(pSocket, eStatus, imsec, __K_FILE__, __K_LINE__) |
| Waits that a socket reaches a particular state before time elapsed. In disconnection cases, the following code is returned "KSOK_RET_DISCONNECTED". If the time is elapsed before status changed, the following code is returned "KSOK_RET_TIMEOUT". | |
| #define | KSocket_readAll(pSocket, pBuffer, pReadBytes) _KSocket_readAll(pSocket, pBuffer, pReadBytes, __K_FILE__, __K_LINE__) |
| Reads data available in the socket. | |
Typedefs | |
| typedef _KSocket | KSocket |
| Sockets. | |
Enumerations | |
| enum | ESokStatus { KSOK_STATUS_NOT_INIT = 0x0001, KSOK_STATUS_WAIT_CONNECTION = 0x0002, KSOK_STATUS_WAIT_DISCONNECT = 0x0003, KSOK_STATUS_CONNECTED = 0x0004, KSOK_STATUS_DISCONNECTED = 0x0005, KSOK_STATUS_AVAILABLE_DATA = 0x0100, KSOK_STATUS_MASK = 0x00ff, KSOK_STATUS_SUBMASK = 0xff00 } |
| Socket states. More... | |
| enum | ESokRet { KSOK_RET_SUCCESS = 0, KSOK_RET_UNKNOWN_ERROR = 1, KSOK_RET_BAD_PARAMETERS = 2, KSOK_ADDR_NOT_FOUND = 3, KSOK_RET_DISCONNECTED = 4, KSOK_RET_BAD_STATUS = 5, KSOK_RET_TIMEOUT = 6, KSOK_RET_SEND_ECHEC = 7, KSOK_RET_NOT_INIT = 8 } |
| Return codes. More... | |
Functions | |
| KTL_API KSocket * | _KSocket_new (KString sFile, KInt32 iLine) |
| Allocates a KSocket structure. | |
| KTL_API void | KSocket_delete (KSocket **pSocket) |
| Deletes a KSocket structure. | |
| KTL_API ESokRet | KSocket_connect (KSocket *pSocket, KCString sServer, KUInt16 iPort) |
| Connects a socket to a server. | |
| KTL_API ESokRet | KSocket_disconnect (KSocket *pSocket) |
| Socket disconnection. | |
| KTL_API KCString | KSocket_getServer (KSocket *pSocket) |
| Returns the server associated to the given socket. | |
| KTL_API KUInt16 | KSocket_getPort (KSocket *pSocket) |
| Returns the port associated to the given socket. | |
| KTL_API ESokStatus | KSocket_getStatus (KSocket *pSocket) |
| Returns the current state of a socket. | |
| KTL_API ESokRet | _KSocket_waitStatus (KSocket *pSocket, ESokStatus eStatus, KString sFile, KInt32 iLine) |
| Waits that a socket reaches a particular state. In disconnection cases, the following code is returned "KSOK_RET_DISCONNECTED". This function is blocking. | |
| KTL_API ESokRet | _KSocket_waitStatusForTime (KSocket *pSocket, ESokStatus eStatus, KUInt32 imsec, KString sFile, KInt32 iLine) |
| Waits that a socket reaches a particular state before time elapsed. In disconnection cases, the following code is returned "KSOK_RET_DISCONNECTED". If the time is elapsed before status changed, the following code is returned "KSOK_RET_TIMEOUT". | |
| KTL_API KUInt64 | KSocket_availableBytes (KSocket *pSocket) |
| Gets the bytes number of available data in read mode. | |
| KTL_API ESokRet | _KSocket_readAll (KSocket *pSocket, KUChar **pBuffer, KUInt64 *pReadBytes, KString sFile, KInt32 iLine) |
| Reads data available in the socket. | |
| KTL_API ESokRet | KSocket_readBytes (KSocket *pSocket, KUChar *pBuffer, KUInt64 iBytesToRead, KUInt64 *pReadBytes) |
| Reads a maximum bytes number of data. | |
| KTL_API ESokRet | KSocket_send (KSocket *pSocket, const KUChar *pBuffer, KUInt64 iBytesToSend) |
| Sending data. Blocking function. | |
| KTL_API ESokRet | KSocket_testConnection (KSocket *pSocket, KUInt32 iMSec) |
| A function for testing connexion. | |
|
|
Allocates a KSocket structure.
|
|
|
Reads data available in the socket.
|
|
|
Waits that a socket reaches a particular state. In disconnection cases, the following code is returned "KSOK_RET_DISCONNECTED". This function is blocking.
|
|
|
Waits that a socket reaches a particular state before time elapsed. In disconnection cases, the following code is returned "KSOK_RET_DISCONNECTED". If the time is elapsed before status changed, the following code is returned "KSOK_RET_TIMEOUT".
|
|
|
|
Socket states.
|
|
||||||||||||
|
Allocates a KSocket structure.
|
|
||||||||||||||||||||||||
|
Reads data available in the socket.
|
|
||||||||||||||||||||
|
Waits that a socket reaches a particular state. In disconnection cases, the following code is returned "KSOK_RET_DISCONNECTED". This function is blocking.
|
|
||||||||||||||||||||||||
|
Waits that a socket reaches a particular state before time elapsed. In disconnection cases, the following code is returned "KSOK_RET_DISCONNECTED". If the time is elapsed before status changed, the following code is returned "KSOK_RET_TIMEOUT".
|
|
|
Gets the bytes number of available data in read mode.
|
|
||||||||||||||||
|
Connects a socket to a server.
|
|
|
Deletes a KSocket structure.
|
|
|
Socket disconnection.
|
|
|
Returns the port associated to the given socket.
|
|
|
Returns the server associated to the given socket.
|
|
|
Returns the current state of a socket.
|
|
||||||||||||||||||||
|
Reads a maximum bytes number of data.
|
|
||||||||||||||||
|
Sending data. Blocking function.
|
|
||||||||||||
|
A function for testing connexion.
|
1.3.8