CAEN Utility  2.0.2
Utilities for CAEN projects
Simplified client/server functions
Collaboration diagram for Simplified client/server functions:

Functions

int32_t c_socket_server_init (c_socket_t **server, uint32_t inaddr, uint16_t *_port)
 
int32_t c_socket_server_accept (const c_socket_t *server, c_socket_t **client)
 
int32_t c_socket_client_sockaddr_connect (c_socket_t **client, const struct sockaddr *addr_server, c_socklen_t addrlen)
 
int32_t c_socket_client_connect (c_socket_t **client, const char *hostname, uint16_t port)
 

Detailed Description

Function Documentation

◆ c_socket_server_init()

int32_t c_socket_server_init ( c_socket_t **  server,
uint32_t  inaddr,
uint16_t *  _port 
)

Server function. Init the socket to receive connection from inaddr:port

Parameters
[in,out]servera location where to put the address of a socket initialized with c_socket_new and to be freed
[out]inaddrthe address we agree to accept. INADDR_ANY (0x00000000) to accept any address.
[out]_portpointer to a uint16_t with the port. If value is 0, a port is automatically choosen and the value is set accordingly
Returns
c_Socket_ErrorCode_Success (0) in case of success. Error codes specified in c_Socket_ErrorCode_t.

Definition at line 317 of file CAENSocket.c.

Here is the call graph for this function:

◆ c_socket_server_accept()

int32_t c_socket_server_accept ( const c_socket_t server,
c_socket_t **  client 
)

Server function. Accept new connection on the initialized socket

Parameters
[in]servera pointer passed through c_socket_server_init()
[out]clienta location where to put the address of a socket initialized with c_socket_new and to be freed
Returns
c_Socket_ErrorCode_Success (0) in case of success. Error codes specified in c_Socket_ErrorCode_t.

Definition at line 395 of file CAENSocket.c.

Here is the call graph for this function:

◆ c_socket_client_sockaddr_connect()

int32_t c_socket_client_sockaddr_connect ( c_socket_t **  client,
const struct sockaddr *  addr_server,
c_socklen_t  addrlen 
)

Client function. Connect to host, port specified by [addr]

Parameters
[in,out]clienta location where to put the address of a socket initialized with c_socket_new and to be freed
[in]addr_serverthe remote address
[in]addrlenthe size, in bytes, of the address structure pointed to by addr
Returns
c_Socket_ErrorCode_Success (0) in case of success. Error codes specified in c_Socket_ErrorCode_t.

Definition at line 425 of file CAENSocket.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ c_socket_client_connect()

int32_t c_socket_client_connect ( c_socket_t **  client,
const char *  hostname,
uint16_t  port 
)

Client function. Connect to [hostname]:[port]

Parameters
[in,out]clienta location where to put the address of a socket initialized with c_socket_new and to be freed
[in]hostnamethe remote address. Either a hostname or an IPv4 address in standard dot notation.
[in]portthe remote port
Returns
c_Socket_ErrorCode_Success (0) in case of success. Error codes specified in c_Socket_ErrorCode_t.

Definition at line 467 of file CAENSocket.c.

Here is the call graph for this function: