diff options
Diffstat (limited to 'core/network.c')
-rw-r--r-- | core/network.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/network.c b/core/network.c index 6337651a..fa6c99fc 100644 --- a/core/network.c +++ b/core/network.c | |||
@@ -101,8 +101,8 @@ int receivepacket(IP_Port * ip_port, uint8_t * data, uint32_t * length) | |||
101 | bind to ip and port | 101 | bind to ip and port |
102 | ip must be in network order EX: 127.0.0.1 = (7F000001) | 102 | ip must be in network order EX: 127.0.0.1 = (7F000001) |
103 | port is in host byte order (this means don't worry about it) | 103 | port is in host byte order (this means don't worry about it) |
104 | returns 0 if no problems | 104 | returns 0 if no problems |
105 | TODO: add something to check if there are errors */ | 105 | returns -1 if there are problems */ |
106 | int init_networking(IP ip ,uint16_t port) | 106 | int init_networking(IP ip ,uint16_t port) |
107 | { | 107 | { |
108 | #ifdef WIN32 | 108 | #ifdef WIN32 |
@@ -146,7 +146,9 @@ int init_networking(IP ip ,uint16_t port) | |||
146 | 146 | ||
147 | /* Bind our socket to port PORT and address 0.0.0.0 */ | 147 | /* Bind our socket to port PORT and address 0.0.0.0 */ |
148 | ADDR addr = {AF_INET, htons(port), ip}; | 148 | ADDR addr = {AF_INET, htons(port), ip}; |
149 | bind(sock, (struct sockaddr*)&addr, sizeof(addr)); | 149 | if(bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1) |
150 | return -1; | ||
151 | |||
150 | return 0; | 152 | return 0; |
151 | 153 | ||
152 | } | 154 | } |