Wiicom API Lib
|
Socket function library. Continua...
Funzioni | |
uint8_t | wiicom_socket_initLibSocket () |
Function that initializes the socket library Warning! This function should be called before using the socket. Continua... | |
void | wiicom_socket_deinitLibSocket () |
Function that de-initialize the socket library Warning! This function is called when not used any more a sockets or, in general, before the close of the program. Continua... | |
void | wiicom_socket_set_timeout_conn (uint8_t sec) |
Function that sets the connection timeout of a socket. Continua... | |
void | wiicom_socket_set_timeout_reciv (uint8_t sec) |
Funzione che imposta il timeout della ricezione dati di un socket. Continua... | |
uint8_t | wiicom_socket_get_timeout_conn () |
Function that returns the seconds after which there is a timeout in the connection of a socket. Continua... | |
uint8_t | wiicom_socket_get_timeout_reciv () |
Function that returns the seconds after which you have a timeout when receiving data. Continua... | |
void | wiicom_socket_set_address (struct sockaddr_in *socket_address, const char *ip, int port) |
Function that set a socket address. Continua... | |
uint8_t | wiicom_socket_blocking (int socket_fd, uint8_t b_block) |
Funzione che imposta il socket come bloccante o non bloccante. Continua... | |
int | wiicom_socket_create (int domain, int type, int protocol) |
Function that create a socket. Continua... | |
void | wiicom_socket_close (int socket_fd) |
Function that close a socket. Continua... | |
int | wiicom_socket_connect (int socketToConnect, struct sockaddr_in *socketToConnect_addr) |
Function that make a socket connection with timeout. Continua... | |
int | wiicom_socket_sendall (int socket_fd, uint8_t *buf, uint16_t *len) |
Function that sends a data buffer on socket. Continua... | |
ssize_t | wiicom_socket_reciv (int socket_fd, void *buffer, size_t buffer_size) |
Function that receives the data transmitted to the socket with timeout On error or timeout the socket is closed. Continua... | |
ssize_t | wiicom_socket_notimeout_reciv (int socket_fd, void *buffer, size_t buffer_size) |
Function that receives the data transmitted to the socket without timeout. Continua... | |
uint8_t | wiicom_socket_shutdown (int socket_fd) |
Function that shut down a socket. Continua... | |
Socket function library.
Generic library for managing socket
uint8_t wiicom_socket_blocking | ( | int | socket_fd, |
uint8_t | b_block | ||
) |
Funzione che imposta il socket come bloccante o non bloccante.
[in] | socket_fd | a file descriptor for the socket |
[in] | b_block | if TRUE sets the socket as a blocker, if FALSE sets it as non-blocking |
void wiicom_socket_close | ( | int | socket_fd | ) |
Function that close a socket.
[in] | socket_fd | a file descriptor for the socket to close |
int wiicom_socket_connect | ( | int | socketToConnect, |
struct sockaddr_in * | socketToConnect_addr | ||
) |
Function that make a socket connection with timeout.
[in] | socketToConnect | a file descriptor for the socket on which connect |
[in] | socketToConnect_addr | sockaddr_in |
int wiicom_socket_create | ( | int | domain, |
int | type, | ||
int | protocol | ||
) |
Function that create a socket.
[in] | domain | communication domain |
[in] | type | specifies the communication semantics |
[in] | protocol | specifies a particular protocol to be used with the socket |
void wiicom_socket_deinitLibSocket | ( | ) |
Function that de-initialize the socket library
Warning! This function is called when not used any more a sockets or, in general, before the close of the program.
uint8_t wiicom_socket_get_timeout_conn | ( | ) |
Function that returns the seconds after which there is a timeout in the connection of a socket.
uint8_t wiicom_socket_get_timeout_reciv | ( | ) |
Function that returns the seconds after which you have a timeout when receiving data.
uint8_t wiicom_socket_initLibSocket | ( | ) |
Function that initializes the socket library
Warning! This function should be called before using the socket.
ssize_t wiicom_socket_notimeout_reciv | ( | int | socket_fd, |
void * | buffer, | ||
size_t | buffer_size | ||
) |
Function that receives the data transmitted to the socket without timeout.
[in] | socket_fd | a file descriptor for the socket where datas are recived |
[out] | buffer | buffer in which datas are loaded |
[in] | buffer_size | size of the buffer containing the data read |
ssize_t wiicom_socket_reciv | ( | int | socket_fd, |
void * | buffer, | ||
size_t | buffer_size | ||
) |
Function that receives the data transmitted to the socket with timeout On error or timeout the socket is closed.
[in] | socket_fd | a file descriptor for the socket where datas are recived |
[out] | buffer | it contains data to send |
[in] | buffer_size | size of the buffer to send |
int wiicom_socket_sendall | ( | int | socket_fd, |
uint8_t * | buf, | ||
uint16_t * | len | ||
) |
Function that sends a data buffer on socket.
[in] | socket_fd | a file descriptor for the socket where datas are send |
[in] | buf | a datas to send |
[in,out] | len | number of bytes in the buffer to be sent, after sending it contains the number of bytes sent |
void wiicom_socket_set_address | ( | struct sockaddr_in * | socket_address, |
const char * | ip, | ||
int | port | ||
) |
Function that set a socket address.
[out] | socket_address | socket_address to set |
[in] | ip | IP address |
[in] | port | Port |
void wiicom_socket_set_timeout_conn | ( | uint8_t | sec | ) |
Function that sets the connection timeout of a socket.
[in] | sec | number of seconds |
void wiicom_socket_set_timeout_reciv | ( | uint8_t | sec | ) |
Funzione che imposta il timeout della ricezione dati di un socket.
[in] | sec | number of seconds |
uint8_t wiicom_socket_shutdown | ( | int | socket_fd | ) |
Function that shut down a socket.
[in] | socket_fd | a file descriptor for the socket to close |