diff --git a/general/src/net/TcpClient.cpp b/general/src/net/TcpClient.cpp index 8b8eb72..44da933 100644 --- a/general/src/net/TcpClient.cpp +++ b/general/src/net/TcpClient.cpp @@ -4,8 +4,6 @@ #include "TcpClient.h" - - void conn_writecb(struct bufferevent *, void *); void conn_readcb(struct bufferevent *, void *); void conn_eventcb(struct bufferevent *, short, void *); @@ -126,8 +124,15 @@ TcpClientLibevent::TcpClientLibevent(std::string addrinfo, int port, TcpClientLi mObserver(nullptr) { memset(&mSrv, 0, sizeof(mSrv)); +#ifdef linux + mSrv.sin_addr.s_addr = inet_addr(addrinfo.c_str()); + mSrv.sin_family = AF_INET; +#endif +#ifdef _WIN32 + mSrv.sin_addr.S_un.S_addr = inet_addr(addrinfo.c_str()); mSrv.sin_family = AF_INET; +#endif mSrv.sin_port = htons(port); mBase = event_base_new(); diff --git a/general/src/net/TcpClient.h b/general/src/net/TcpClient.h index 8948127..40bf006 100644 --- a/general/src/net/TcpClient.h +++ b/general/src/net/TcpClient.h @@ -8,6 +8,13 @@ #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 #endif +#ifdef linux +#include +#include +#include +#define EVENT__HAVE_PTHREADS +#endif + extern "C"{ #include "third/include/event2/bufferevent.h" #include "third/include/event2/buffer.h"