1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
//if_net_udp_linux.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
typedef int SOCKET;
typedef struct sockaddr_in SOCKADDR_IN;//l'interface n'a pas besoin de connaître SOCKADDR_IN
typedef struct sockaddr SOCKADDR;
socket if_net_open_socket(int domain, int type, int port){...}
int if_net_select_socket(){...}
int if_net_send(){...}
int if_net_receive(){...}
int if_net_close_socket(){...}
//if_net_udp_windows.c
#include "winsock2.h"
typedef int socklen_t;
socket if_net_open_socket(int domain, int type, int port){...}
int if_net_select_socket(){...}
int if_net_send(){...}
int if_net_receive(){...}
int if_net_close_socket(){...}
//if_net.h
typedef SOCKET socket;
socket if_net_open_socket(int domain, int type, int port);
int if_net_select_socket();
int if_net_send();
int if_net_receive();
int if_net_close_socket(); |
Partager