From 14f0bb0f2f113d81947de8ca4c023cdc6a930fa8 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Sat, 10 Feb 2018 13:06:45 +0800 Subject: [PATCH] Fix compile error on Linux --- gsock.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gsock.cpp b/gsock.cpp index 0210648..48cca39 100644 --- a/gsock.cpp +++ b/gsock.cpp @@ -36,6 +36,7 @@ using BYTE = unsigned char; #endif +#include /// memset #include #include @@ -183,7 +184,7 @@ int sock::getsendtime(int& _out_Second, int& _out_uSecond) int& sfd=_pp->sfd; struct timeval outtime; - int _not_used_t; + socklen_t _not_used_t; int ret=getsockopt(sfd,SOL_SOCKET,SO_SNDTIMEO,(char*)&outtime,&_not_used_t); if(ret<0) return ret; /// We don't know why, but on Windows, 1 Second means 1000. @@ -204,7 +205,7 @@ int sock::getrecvtime(int& _out_Second, int& _out_uSecond) int& sfd=_pp->sfd; struct timeval outtime; - int _not_used_t; + socklen_t _not_used_t; int ret=getsockopt(sfd,SOL_SOCKET,SO_RCVTIMEO,(char*)&outtime,&_not_used_t); if(ret<0) return ret; /// We don't know why, but on Windows, 1 Second means 1000. @@ -342,7 +343,7 @@ int serversock::accept(sock& _out_s) } sock s; - int tmp=sizeof(s._pp->saddr); + socklen_t tmp=sizeof(s._pp->saddr); int ret=::accept(_pp->sfd,(sockaddr*)&(s._pp->saddr),&tmp); if(ret<0) {