Implement various WIN32 fixes

This commit is contained in:
Lion Kortlepel
2020-11-03 12:50:05 +01:00
parent f144d451c7
commit c5c21c43ad
5 changed files with 48 additions and 28 deletions

View File

@@ -17,8 +17,14 @@ struct Hold{
bool Done = false;
};
bool Send(SOCKET TCPSock,std::string Data){
ssize_t BytesSent;
BytesSent = send(TCPSock, Data.c_str(), size_t(Data.size()), 0);
#ifdef WIN32
int BytesSent;
int len = static_cast<int>(Data.size());
#else
int64_t BytesSent;
size_t len = Data.size();
#endif // WIN32
BytesSent = send(TCPSock, Data.c_str(), len, 0);
Data.clear();
if (BytesSent <= 0)return false;
return true;
@@ -27,7 +33,7 @@ std::string Rcv(SOCKET TCPSock){
char buf[6768];
size_t len = 6768;
ZeroMemory(buf, len);
ssize_t BytesRcv = recv(TCPSock, buf, len,0);
int64_t BytesRcv = recv(TCPSock, buf, len,0);
if (BytesRcv <= 0)return "";
return std::string(buf);
}