source: Daodan/MSVC/Flatline_Net.h@ 902

Last change on this file since 902 was 589, checked in by gumby, 13 years ago

stuff

File size: 1.0 KB
Line 
1#ifndef FLATLINE_NET_H
2#define FLATLINE_NET_H
3
4#define pad1_size (sizeof(int64_t) - sizeof(short))
5#define pad2_size (128 - (sizeof(short) + pad1_size + sizeof(int64_t)))
6
7
8typedef struct hostent hostent ;
9typedef struct in_addr in_addr;
10
11typedef struct {
12 short ss_family;
13 char pad1[pad1_size];
14 uint64_t pad64;
15 char pad2[pad2_size];
16} sockaddr_storage;
17
18typedef struct sockaddr sockaddr;
19typedef struct sockaddr_in sockaddr_in;
20typedef sockaddr_storage sockaddr_in6;
21
22void NetCatchError();
23
24bool NetUDPServer_Listen(uint16_t port, bool (*packet_callback)(char* data, int datalen, int from));
25bool NetUDPServer_Send(sockaddr* address, char* data, int datalen);
26
27int NetUDPSocket_Create(uint16_t port, sockaddr_in* address);
28int NetTCPSocket_Create(uint16_t port, sockaddr_in* address);
29int NetUDPSocket_Send(int socket, const sockaddr* address, const char* data, int datalen);
30void NetUDPSocket_Close(int sock);
31bool NetUDPSocket_Recieve(int socket, sockaddr_storage* address, char* data, uint16_t* datalen);
32
33#endif
Note: See TracBrowser for help on using the repository browser.