Wiicom API Lib
 Tutto Strutture dati File Funzioni Variabili Ridefinizioni di tipo (typedef) Tipi enumerati (enum) Valori del tipo enumerato Definizioni Gruppi
C:/WIICOM-SVN/Sviluppo/Software/library/wiicom_lib/trunk/wiicom_libsocket.h
Vai alla documentazione di questo file.
1 
19 #ifndef _WIICOM_LIBSOCKET_H
20 #define _WIICOM_LIBSOCKET_H
21 
22 #if (defined (__WIN32__))
23  #pragma comment(lib, "ws2_32.lib")
24 
25  //#include <winsock2.h>
26  #include <windows.h>
27  #include <stdint.h>
28 
29  #define ssize_t SSIZE_T
30 
31 #else
32  #include <sys/time.h>
33  #include <sys/types.h>
34  #include <sys/socket.h>
35  #include <netinet/in.h>
36  #include <netdb.h>
37  #include <arpa/inet.h>
38  #include <sys/select.h>
39  #include <fcntl.h>
40 #include <unistd.h>
41 #endif //if (defined (__WIN32__))
42 
43 
44 #define SEC_TIMEOUT_CONNECT_SOCKET 5
45 #define SEC_TIMEOUT_RECIV_SOCKET 10
52 uint8_t wiicom_socket_initLibSocket();
53 
60 
66 void wiicom_socket_set_timeout_conn(uint8_t sec);
67 
73 void wiicom_socket_set_timeout_reciv(uint8_t sec);
74 
80 
86 
93 uint8_t wiicom_socket_blocking(int socket_fd,uint8_t b_block);
94 
102 void wiicom_socket_set_address(struct sockaddr_in *socket_address,const char *ip,int port);
103 
111 int wiicom_socket_create(int domain, int type, int protocol);
112 
118 void wiicom_socket_close(int socket_fd);
119 
126 int wiicom_socket_connect(int socketToConnect, struct sockaddr_in *socketToConnect_addr);
127 
135 int wiicom_socket_sendall(int socket_fd, uint8_t *buf, uint16_t *len);
136 
145 ssize_t wiicom_socket_reciv(int socket_fd,void *buffer,size_t buffer_size);
146 
154 ssize_t wiicom_socket_notimeout_reciv(int socket_fd,void *buffer,size_t buffer_size);
155 
156 
162 uint8_t wiicom_socket_shutdown(int socket_fd);
163 
164 #endif
165 
void wiicom_socket_set_timeout_reciv(uint8_t sec)
Funzione che imposta il timeout della ricezione dati di un socket.
Definition: wiicom_libsocket.c:100
void wiicom_socket_deinitLibSocket()
Function that de-initialize the socket library Warning! This function is called when not used any mor...
Definition: wiicom_libsocket.c:88
uint8_t wiicom_socket_get_timeout_reciv()
Function that returns the seconds after which you have a timeout when receiving data.
Definition: wiicom_libsocket.c:110
int wiicom_socket_create(int domain, int type, int protocol)
Function that create a socket.
Definition: wiicom_libsocket.c:163
void wiicom_socket_set_address(struct sockaddr_in *socket_address, const char *ip, int port)
Function that set a socket address.
Definition: wiicom_libsocket.c:115
uint8_t wiicom_socket_shutdown(int socket_fd)
Function that shut down a socket.
Definition: wiicom_libsocket.c:396
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.
Definition: wiicom_libsocket.c:372
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...
Definition: wiicom_libsocket.c:310
void wiicom_socket_set_timeout_conn(uint8_t sec)
Function that sets the connection timeout of a socket.
Definition: wiicom_libsocket.c:95
void wiicom_socket_close(int socket_fd)
Function that close a socket.
Definition: wiicom_libsocket.c:180
uint8_t wiicom_socket_get_timeout_conn()
Function that returns the seconds after which there is a timeout in the connection of a socket...
Definition: wiicom_libsocket.c:105
int wiicom_socket_sendall(int socket_fd, uint8_t *buf, uint16_t *len)
Function that sends a data buffer on socket.
Definition: wiicom_libsocket.c:280
uint8_t wiicom_socket_blocking(int socket_fd, uint8_t b_block)
Funzione che imposta il socket come bloccante o non bloccante.
Definition: wiicom_libsocket.c:127
int wiicom_socket_connect(int socketToConnect, struct sockaddr_in *socketToConnect_addr)
Function that make a socket connection with timeout.
Definition: wiicom_libsocket.c:189