Changed bind() == -1 check to INVALID_SOCK check

This commit is contained in:
Astonex 2013-07-24 01:22:45 +01:00
parent 29aa702a4f
commit 0af0c274d3

View File

@ -119,6 +119,10 @@ int init_networking(IP ip ,uint16_t port)
/* initialize our socket */
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
/* Check for socket error */
if (sock == INVALID_SOCKET)
return -1;
/* Functions to increase the size of the send and receive UDP buffers
NOTE: uncomment if necessary */
@ -146,8 +150,7 @@ int init_networking(IP ip ,uint16_t port)
/* Bind our socket to port PORT and address 0.0.0.0 */
ADDR addr = {AF_INET, htons(port), ip};
if(bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1)
return -1;
bind(sock, (struct sockaddr*)&addr, sizeof(addr));
return 0;