|
libcmutils 0.6.5
Multi-platform C99 utility library
|
Socket object. More...
Data Fields | |
| CMSocketResult(* | Read )(const CMUTIL_Socket *socket, CMUTIL_ByteBuffer *buffer, uint32_t size, long timeout) |
| Read data from the socket into a buffer. | |
| CMSocketResult(* | Write )(const CMUTIL_Socket *socket, const void *data, uint32_t size, long timeout) |
| Write the given data to the socket into a buffer. | |
| CMSocketResult(* | WritePart )(const CMUTIL_Socket *socket, const void *data, uint32_t offset, uint32_t length, long timeout) |
| Write a specific part of data to the socket from a buffer. | |
| CMSocketResult(* | CheckReadBuffer )(const CMUTIL_Socket *socket, long timeout) |
| Check if the socket is ready for reading. | |
| CMSocketResult(* | CheckWriteBuffer )(const CMUTIL_Socket *socket, long timeout) |
| Check if the socket is ready for writing. | |
| CMUTIL_Socket *(* | ReadSocket )(const CMUTIL_Socket *socket, long timeout, CMSocketResult *rval) |
| Read a socket object from the current socket. | |
| CMSocketResult(* | WriteSocket )(const CMUTIL_Socket *socket, CMUTIL_Socket *tobesent, pid_t pid, long timeout) |
| Write a socket object to the current socket. | |
| CMSocketResult(* | GetRemoteAddr )(const CMUTIL_Socket *socket, CMUTIL_SocketAddr *addr) |
| Get the remote address of the socket. | |
| void(* | Close )(CMUTIL_Socket *socket) |
| Close the socket. | |
| SOCKET(* | GetRawSocket )(const CMUTIL_Socket *socket) |
| Get the raw socket descriptor. | |
| int(* | ReadByte )(const CMUTIL_Socket *socket, long timeout) |
| Read a single byte from the socket. | |
| CMSocketResult(* | WriteByte )(const CMUTIL_Socket *socket, uint8_t c, long timeout) |
| Write a single byte to the socket. | |
| void(* | SetSilent )(CMUTIL_Socket *socket, CMBool silent) |
| Suppress this library's own error logging on this socket. | |
Socket object.
| CMSocketResult(* CMUTIL_Socket::Read) (const CMUTIL_Socket *socket, CMUTIL_ByteBuffer *buffer, uint32_t size, long timeout) |
Read data from the socket into a buffer.
Reads up to 'size' bytes of data from the specified socket into the provided byte buffer within the given timeout period.
| socket | The socket object to read from. |
| buffer | The byte buffer to store the read data. |
| size | The maximum number of bytes to read. |
| timeout | The read operation timeout in milliseconds. |
| CMSocketResult(* CMUTIL_Socket::Write) (const CMUTIL_Socket *socket, const void *data, uint32_t size, long timeout) |
Write the given data to the socket into a buffer.
Writes all data from the provided byte buffer to the specified socket within the specified timeout period.
| socket | The socket object to write to. |
| data | The data to write. |
| size | The size of the data to write. |
| timeout | The read operation timeout in milliseconds. |
| CMSocketResult(* CMUTIL_Socket::WritePart) (const CMUTIL_Socket *socket, const void *data, uint32_t offset, uint32_t length, long timeout) |
Write a specific part of data to the socket from a buffer.
Writes 'length' bytes of data from the provided string buffer starting at the given offset to the specified socket within the specified timeout period.
| socket | The socket object to write to. |
| data | The data to write. |
| offset | The offset in the buffer to start writing from. |
| length | The number of bytes to write. |
| timeout | The write operation timeout in milliseconds. |
| CMSocketResult(* CMUTIL_Socket::CheckReadBuffer) (const CMUTIL_Socket *socket, long timeout) |
Check if the socket is ready for reading.
This function checks if there is data available to read from the socket within the specified timeout period.
| socket | The socket object to check. |
| timeout | The timeout period in milliseconds. |
| CMSocketResult(* CMUTIL_Socket::CheckWriteBuffer) (const CMUTIL_Socket *socket, long timeout) |
Check if the socket is ready for writing.
This function checks if the socket is ready to accept data for writing within the specified timeout period.
| socket | The socket object to check. |
| timeout | The timeout period in milliseconds. |
| CMUTIL_Socket *(* CMUTIL_Socket::ReadSocket) (const CMUTIL_Socket *socket, long timeout, CMSocketResult *rval) |
Read a socket object from the current socket.
This function reads a new socket object from the current socket within the specified timeout period.
| socket | The socket object to read from. |
| timeout | The read operation timeout in milliseconds. |
| rval | Pointer to store the result of the read operation. |
| CMSocketResult(* CMUTIL_Socket::WriteSocket) (const CMUTIL_Socket *socket, CMUTIL_Socket *tobesent, pid_t pid, long timeout) |
Write a socket object to the current socket.
This function writes the specified socket object to the current socket within the specified timeout period.
| socket | The socket object to write to. |
| tobesent | The socket object to be sent. |
| pid | The process ID associated with the socket. |
| timeout | The write operation timeout in milliseconds. |
| CMSocketResult(* CMUTIL_Socket::GetRemoteAddr) (const CMUTIL_Socket *socket, CMUTIL_SocketAddr *addr) |
Get the remote address of the socket.
This function retrieves the remote address of the specified socket and stores it in the provided socket address object.
| socket | The socket object to get the remote address from. |
| addr | Pointer to the CMUTIL_SocketAddr object to store the address. |
| void(* CMUTIL_Socket::Close) (CMUTIL_Socket *socket) |
Close the socket.
This function closes the specified socket and releases any associated resources.
| socket | The socket object to be closed. |
| SOCKET(* CMUTIL_Socket::GetRawSocket) (const CMUTIL_Socket *socket) |
Get the raw socket descriptor.
This function retrieves the underlying raw socket descriptor associated with the specified socket object.
| socket | The socket object to get the raw socket from. |
| int(* CMUTIL_Socket::ReadByte) (const CMUTIL_Socket *socket, long timeout) |
Read a single byte from the socket.
This function reads a single byte from the specified socket.
| socket | The socket object to read from. |
| timeout | Timeout in milliseconds for the read operation. |
| CMSocketResult(* CMUTIL_Socket::WriteByte) (const CMUTIL_Socket *socket, uint8_t c, long timeout) |
Write a single byte to the socket.
This function writes a single byte to the specified socket.
| socket | The socket object to write to. |
| c | The byte to be written. |
| timeout | Timeout in milliseconds for the write operation. |
| void(* CMUTIL_Socket::SetSilent) (CMUTIL_Socket *socket, CMBool silent) |
Suppress this library's own error logging on this socket.
A disconnect a server expects - a client that simply went away - is not worth an error line. Turning this on demotes those messages to trace level; the return codes are unaffected.
| socket | The socket object. |
| silent | CMTrue to stop logging errors for this socket. |