diff options
Diffstat (limited to 'toxcore/network.c')
-rw-r--r-- | toxcore/network.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/toxcore/network.c b/toxcore/network.c index 666846db..9e329949 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -60,9 +60,13 @@ uint32_t random_int(void) | |||
60 | /* Basic network functions: | 60 | /* Basic network functions: |
61 | * Function to send packet(data) of length length to ip_port. | 61 | * Function to send packet(data) of length length to ip_port. |
62 | */ | 62 | */ |
63 | #ifdef WIN32 | ||
64 | int sendpacket(unsigned int sock, IP_Port ip_port, uint8_t *data, uint32_t length) | ||
65 | #else | ||
63 | int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length) | 66 | int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length) |
67 | #endif | ||
64 | { | 68 | { |
65 | ADDR addr = {AF_INET, ip_port.port, ip_port.ip}; | 69 | ADDR addr = {AF_INET, ip_port.port, ip_port.ip, {0}}; |
66 | return sendto(sock, (char *) data, length, 0, (struct sockaddr *)&addr, sizeof(addr)); | 70 | return sendto(sock, (char *) data, length, 0, (struct sockaddr *)&addr, sizeof(addr)); |
67 | } | 71 | } |
68 | 72 | ||
@@ -72,7 +76,11 @@ int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length) | |||
72 | * Packet length is put into length. | 76 | * Packet length is put into length. |
73 | * Dump all empty packets. | 77 | * Dump all empty packets. |
74 | */ | 78 | */ |
79 | #ifdef WIN32 | ||
80 | static int receivepacket(unsigned int sock, IP_Port *ip_port, uint8_t *data, uint32_t *length) | ||
81 | #else | ||
75 | static int receivepacket(int sock, IP_Port *ip_port, uint8_t *data, uint32_t *length) | 82 | static int receivepacket(int sock, IP_Port *ip_port, uint8_t *data, uint32_t *length) |
83 | #endif | ||
76 | { | 84 | { |
77 | ADDR addr; | 85 | ADDR addr; |
78 | #ifdef WIN32 | 86 | #ifdef WIN32 |
@@ -207,7 +215,7 @@ Networking_Core *new_networking(IP ip, uint16_t port) | |||
207 | #endif | 215 | #endif |
208 | 216 | ||
209 | /* Bind our socket to port PORT and address 0.0.0.0 */ | 217 | /* Bind our socket to port PORT and address 0.0.0.0 */ |
210 | ADDR addr = {AF_INET, htons(port), ip}; | 218 | ADDR addr = {AF_INET, htons(port), ip, {0}}; |
211 | bind(temp->sock, (struct sockaddr *)&addr, sizeof(addr)); | 219 | bind(temp->sock, (struct sockaddr *)&addr, sizeof(addr)); |
212 | return temp; | 220 | return temp; |
213 | } | 221 | } |