diff options
Diffstat (limited to 'core/network.c')
-rw-r--r-- | core/network.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/network.c b/core/network.c index fa6c99fc..8c8d8875 100644 --- a/core/network.c +++ b/core/network.c | |||
@@ -119,6 +119,10 @@ int init_networking(IP ip ,uint16_t port) | |||
119 | 119 | ||
120 | /* initialize our socket */ | 120 | /* initialize our socket */ |
121 | sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | 121 | sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); |
122 | |||
123 | /* Check for socket error */ | ||
124 | if (sock == INVALID_SOCKET) | ||
125 | return -1; | ||
122 | 126 | ||
123 | /* Functions to increase the size of the send and receive UDP buffers | 127 | /* Functions to increase the size of the send and receive UDP buffers |
124 | NOTE: uncomment if necessary */ | 128 | NOTE: uncomment if necessary */ |
@@ -146,8 +150,7 @@ int init_networking(IP ip ,uint16_t port) | |||
146 | 150 | ||
147 | /* Bind our socket to port PORT and address 0.0.0.0 */ | 151 | /* Bind our socket to port PORT and address 0.0.0.0 */ |
148 | ADDR addr = {AF_INET, htons(port), ip}; | 152 | ADDR addr = {AF_INET, htons(port), ip}; |
149 | if(bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) | 153 | bind(sock, (struct sockaddr*)&addr, sizeof(addr)); |
150 | return -1; | ||
151 | 154 | ||
152 | return 0; | 155 | return 0; |
153 | 156 | ||