Skip to content

Commit 8126fbc

Browse files
Fix warnings in net_port.cpp
1 parent 6648742 commit 8126fbc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

net_port/net_port.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
#include <stdlib.h>
2424
#include <iostream>
2525

26+
#ifdef _WIN32
27+
#define connect_socklen_t int
28+
#else
29+
#define connect_socklen_t socklen_t
30+
#endif
31+
2632
const char yes = 1;
2733

2834
net_port::net_port()
@@ -109,7 +115,7 @@ int net_port::udp_listen_timeout(char * recv_data, int length, int sec, int usec
109115
tv.tv_sec = sec;
110116
tv.tv_usec = usec;
111117

112-
if(select(sock, &fds, NULL, NULL, &tv) <= 0)
118+
if(select((int)sock, &fds, NULL, NULL, &tv) <= 0)
113119
{
114120
return(0);
115121
}
@@ -177,7 +183,7 @@ bool net_port::tcp_client_connect()
177183
connected = false;
178184
return(false);
179185
}
180-
connect(sock, res->ai_addr, res->ai_addrlen);
186+
connect(sock, res->ai_addr, (connect_socklen_t)res->ai_addrlen);
181187

182188
FD_ZERO(&fdset);
183189
FD_SET(sock, &fdset);
@@ -334,7 +340,7 @@ int net_port::tcp_write(char * buffer, int length)
334340
waitd.tv_sec = 5;
335341
waitd.tv_usec = 0;
336342

337-
if(select(*(clients[i]) + 1, NULL, &writefd, NULL, &waitd))
343+
if(select((int)*(clients[i]) + 1, NULL, &writefd, NULL, &waitd))
338344
{
339345
val = send(*(clients[i]), (const char *)&length, sizeof(length), 0);
340346

0 commit comments

Comments
 (0)