summaryrefslogtreecommitdiff
path: root/core/network.c
diff options
context:
space:
mode:
authorAstonex <softukitu@gmail.com>2013-07-24 01:22:45 +0100
committerAstonex <softukitu@gmail.com>2013-07-24 01:22:45 +0100
commit0af0c274d345020c8002c42b4dddb854dc78073e (patch)
tree2682910c41590fa24d84f02fa17528f2516c9ec1 /core/network.c
parent29aa702a4f0cc50c091e0e9624d5ee897138ddf3 (diff)
Changed bind() == -1 check to INVALID_SOCK check
Diffstat (limited to 'core/network.c')
-rw-r--r--core/network.c7
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