Gestion pour que ça marche partout

This commit is contained in:
MarcEricMartel 2023-10-30 11:11:13 -04:00
parent a95dd02896
commit 3da8be6d52
2 changed files with 4 additions and 3 deletions

View File

@ -46,10 +46,11 @@ typedef uint64_t Timestamp;
#include <cstdio> #include <cstdio>
#include <ctime> #include <ctime>
#define flag_t u_long
#define addrlen_t int
#define ioctl ioctlsocket #define ioctl ioctlsocket
#define SOCK_NONBLOCK FIONBIO #define SOCK_NONBLOCK FIONBIO
#define strcpy strcpy_s #define strcpy strcpy_s
#define addrlen_t int
#define popen _popen #define popen _popen
#define pclose _pclose #define pclose _pclose
@ -64,7 +65,7 @@ typedef uint64_t Timestamp;
#include <netinet/in.h> #include <netinet/in.h>
#include <cstring> #include <cstring>
#define flag_t unsigned int
#define addrlen_t unsigned int #define addrlen_t unsigned int
#define SOCKET int #define SOCKET int
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1

View File

@ -57,7 +57,7 @@ int Connector::Connect(const char* srv_addr, std::string name) {
return 2; return 2;
} }
u_long flag = 1; flag_t flag = 1;
if (ioctl(m_sock_tcp, SOCK_NONBLOCK, &flag) < 0) { if (ioctl(m_sock_tcp, SOCK_NONBLOCK, &flag) < 0) {
std::cout << "Impossible de mettre le socket en mode non-bloquant." << std::endl; std::cout << "Impossible de mettre le socket en mode non-bloquant." << std::endl;
return 3; return 3;