The socket client function definitions. More...
Go to the source code of this file.
Functions | |
QSC_EXPORT_API qsc_socket_address_families | qsc_socket_client_address_family (const qsc_socket *sock) |
Get the sockets address family, IPv4 or IPv6. | |
QSC_EXPORT_API qsc_socket_protocols | qsc_socket_client_socket_protocol (const qsc_socket *sock) |
Get the socket protocol type. | |
QSC_EXPORT_API qsc_socket_exceptions | qsc_socket_client_connect_host (qsc_socket *sock, const char *host, const char *service) |
Connect to a remote host using the network host name and service name. | |
QSC_EXPORT_API qsc_socket_exceptions | qsc_socket_client_connect_ipv4 (qsc_socket *sock, const qsc_ipinfo_ipv4_address *address, uint16_t port) |
Establishes a socket connection to a remote host using IPv4 addressing. | |
QSC_EXPORT_API qsc_socket_exceptions | qsc_socket_client_connect_ipv6 (qsc_socket *sock, const qsc_ipinfo_ipv6_address *address, uint16_t port) |
Establishes a socket connection to a remote host using IPv6 addressing. | |
QSC_EXPORT_API qsc_socket_transports | qsc_socket_client_socket_transport (const qsc_socket *sock) |
Get the socket transport type. | |
QSC_EXPORT_API void | qsc_socket_client_initialize (qsc_socket *sock) |
Initialize the server socket. | |
QSC_EXPORT_API size_t | qsc_socket_client_receive (const qsc_socket *sock, char *output, size_t otplen, qsc_socket_receive_flags flag) |
Receive data from a synchronous connected socket or a bound connectionless socket. | |
QSC_EXPORT_API size_t | qsc_socket_client_receive_from (qsc_socket *sock, char *address, uint16_t port, char *output, size_t otplen, qsc_socket_receive_flags flag) |
Receive UDP data from a remote host. | |
QSC_EXPORT_API size_t | qsc_socket_client_send (const qsc_socket *sock, const char *input, size_t inplen, qsc_socket_send_flags flag) |
Sends data on a connected socket. | |
QSC_EXPORT_API size_t | qsc_socket_client_send_to (const qsc_socket *sock, const char *address, uint16_t port, const char *input, size_t inplen, qsc_socket_send_flags flag) |
Sends UDP data to a remote host. | |
QSC_EXPORT_API void | qsc_socket_client_shut_down (qsc_socket *sock) |
Shut down channels and close the socket. | |
The socket client function definitions.
This header provides the interface for socket client operations, including connecting to remote hosts via host names or IP addresses (IPv4 and IPv6). It defines functions to retrieve socket attributes such as address family, protocol, and transport type, as well as functions to initialize client sockets, connect, send and receive data, and gracefully shut down socket connections.
QSC_EXPORT_API qsc_socket_address_families qsc_socket_client_address_family | ( | const qsc_socket * | sock | ) |
Get the sockets address family, IPv4 or IPv6.
sock | [const qsc_socket*] A pointer to the initialized socket |
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_client_connect_host | ( | qsc_socket * | sock, |
const char * | host, | ||
const char * | service ) |
Connect to a remote host using the network host name and service name.
sock | [qsc_socket*] A pointer to the initialized socket |
host | [const char*] The remote host name |
service | [const char*] The service name |
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_client_connect_ipv4 | ( | qsc_socket * | sock, |
const qsc_ipinfo_ipv4_address * | address, | ||
uint16_t | port ) |
Establishes a socket connection to a remote host using IPv4 addressing.
sock | [qsc_socket*] A pointer to the initialized socket |
address | [const qsc_ipinfo_ipv4_address*] The remote hosts IPv4 address |
port | [uint16_t] The remote hosts service port number |
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_client_connect_ipv6 | ( | qsc_socket * | sock, |
const qsc_ipinfo_ipv6_address * | address, | ||
uint16_t | port ) |
Establishes a socket connection to a remote host using IPv6 addressing.
sock | [qsc_socket*] A pointer to the initialized socket |
address | [const qsc_ipinfo_ipv6_address*] The remote hosts IPv6 address |
port | [uint16_t] The remote hosts service port number |
QSC_EXPORT_API void qsc_socket_client_initialize | ( | qsc_socket * | sock | ) |
Initialize the server socket.
sock | [qsc_socket*] A pointer to the socket structure |
QSC_EXPORT_API size_t qsc_socket_client_receive | ( | const qsc_socket * | sock, |
char * | output, | ||
size_t | otplen, | ||
qsc_socket_receive_flags | flag ) |
Receive data from a synchronous connected socket or a bound connectionless socket.
sock | [const qsc_socket*] A pointer to the initialized socket |
output | [size_t] The buffer that receives incoming data |
otplen | [size_t] The length of the output buffer |
flag | [qsc_socket_receive_flags] Flag that influences the behavior of the receive function |
QSC_EXPORT_API size_t qsc_socket_client_receive_from | ( | qsc_socket * | sock, |
char * | address, | ||
uint16_t | port, | ||
char * | output, | ||
size_t | otplen, | ||
qsc_socket_receive_flags | flag ) |
Receive UDP data from a remote host.
sock | [qsc_socket*] A pointer to the initialized socket |
address | [char*] The remote host address |
port | [uint16_t] The remote port |
output | [char*] The output buffer receiving the data |
otplen | [size_t] The number of bytes in the output buffer |
flag | [qsc_socket_receive_flags] Flag that influence the behavior of the receive function |
QSC_EXPORT_API size_t qsc_socket_client_send | ( | const qsc_socket * | sock, |
const char * | input, | ||
size_t | inplen, | ||
qsc_socket_send_flags | flag ) |
Sends data on a connected socket.
sock | [const qsc_socket*] A pointer to the initialized socket |
input | [const char*] The input buffer containing the data to be transmitted |
inplen | [size_t] The number of bytes to send |
flag | [qsc_socket_send_flags] Flag that influence the behavior of the send function |
QSC_EXPORT_API size_t qsc_socket_client_send_to | ( | const qsc_socket * | sock, |
const char * | address, | ||
uint16_t | port, | ||
const char * | input, | ||
size_t | inplen, | ||
qsc_socket_send_flags | flag ) |
Sends UDP data to a remote host.
sock | [const qsc_socket*] A pointer to the initialized socket |
address | [const char*] The remote host address |
port | [uint16_t] The remote port |
input | [const char*] The input buffer containing the data to be transmitted |
inplen | [size_t] The number of bytes to send |
flag | [qsc_socket_send_flags] Flag that influence the behavior of the send function |
QSC_EXPORT_API void qsc_socket_client_shut_down | ( | qsc_socket * | sock | ) |
Shut down channels and close the socket.
sock | [qsc_socket*] A pointer to the initialized socket |
QSC_EXPORT_API qsc_socket_protocols qsc_socket_client_socket_protocol | ( | const qsc_socket * | sock | ) |
Get the socket protocol type.
sock | [const qsc_socket*] A pointer to the initialized socket |
QSC_EXPORT_API qsc_socket_transports qsc_socket_client_socket_transport | ( | const qsc_socket * | sock | ) |
Get the socket transport type.
sock | [const qsc_socket*] A pointer to the initialized socket |