Socket for reading and writing bytes via TCP. More...
Typedefs | |
typedef kzsError(* | kzsTCPSocketConnectionCallback )(const void *userData, kzsError connectionResult) |
Function type for checking the connection status of custom ipc. More... | |
Functions | |
kzsError | kzsTCPSocketCreateServer (kzString inetAddress, kzUint port, const void *userData, kzsTCPSocketConnectionCallback connectionCallback, struct KzsTCPSocket **out_tcpSocket) |
Creates a new TCP server socket connection using specified address and port. More... | |
kzsError | kzsTCPSocketCreateClient (kzString inetAddress, kzUint port, const void *userData, kzsTCPSocketConnectionCallback connectionCallback, struct KzsTCPSocket **out_tcpSocket) |
Creates a new TCP client socket connection using specified address and port. More... | |
kzsError | kzsTCPSocketDelete (struct KzsTCPSocket *tcpSocket) |
Deletes and does clean-up for tcp socket. More... | |
kzsError | kzsTCPSocketReadBytes (const struct KzsTCPSocket *tcpSocket, kzUint byteCount, kzUint *out_bytesReadCount, kzByte *out_bytes) |
Reads bytes from TCP Socket. More... | |
kzsError | kzsTCPSocketWriteBytes (const struct KzsTCPSocket *tcpSocket, kzUint byteCount, const kzByte *bytes, kzUint *out_bytesWrittenCount) |
Writes bytes for TCP Socket. More... | |
kzBool | kzsTCPSocketIsConnected (const struct KzsTCPSocket *tcpSocket) |
Returns if TCP socket is connected. More... | |
Socket for reading and writing bytes via TCP.
Copyright 2008-2020 by Rightware. All rights reserved.
Function type for checking the connection status of custom ipc.
Implementor of the callback function should also check the connectionResult for error cases.
kzsError kzsTCPSocketCreateServer | ( | kzString | inetAddress, |
kzUint | port, | ||
const void * | userData, | ||
kzsTCPSocketConnectionCallback | connectionCallback, | ||
struct KzsTCPSocket ** | out_tcpSocket | ||
) |
Creates a new TCP server socket connection using specified address and port.
This function returns immediately. The server starts listening for a connection in a new thread and notifies with connectionCallback when the socket is connected.
kzsError kzsTCPSocketCreateClient | ( | kzString | inetAddress, |
kzUint | port, | ||
const void * | userData, | ||
kzsTCPSocketConnectionCallback | connectionCallback, | ||
struct KzsTCPSocket ** | out_tcpSocket | ||
) |
Creates a new TCP client socket connection using specified address and port.
This function returns immediately. The client starts connecting in a new thread and notifies with connectionCallback when the socket is connected.
kzsError kzsTCPSocketDelete | ( | struct KzsTCPSocket * | tcpSocket | ) |
Deletes and does clean-up for tcp socket.
kzsError kzsTCPSocketReadBytes | ( | const struct KzsTCPSocket * | tcpSocket, |
kzUint | byteCount, | ||
kzUint * | out_bytesReadCount, | ||
kzByte * | out_bytes | ||
) |
Reads bytes from TCP Socket.
The requested byte count is given as parameter and the actual number of bytes read is returned. Negative number is returned, if no data is available.
kzsError kzsTCPSocketWriteBytes | ( | const struct KzsTCPSocket * | tcpSocket, |
kzUint | byteCount, | ||
const kzByte * | bytes, | ||
kzUint * | out_bytesWrittenCount | ||
) |
Writes bytes for TCP Socket.
The number of bytes to be written is given as parameter and the actual number of bytes written is returned. Negative number is returned, if no bytes can be written.
kzBool kzsTCPSocketIsConnected | ( | const struct KzsTCPSocket * | tcpSocket | ) |
Returns if TCP socket is connected.