diff --git a/gsock.cpp b/gsock.cpp index 48cca39..9443345 100644 --- a/gsock.cpp +++ b/gsock.cpp @@ -168,14 +168,14 @@ int sock::connect(const std::string& IPStr,int Port) return ::connect(sfd,(sockaddr*)&saddr,sizeof(saddr)); } -int sock::send(const char* Buffer,int Length) +int sock::send(const void* Buffer,int Length) { - return ::send(_pp->sfd,Buffer,Length,0); + return ::send(_pp->sfd,(const char*)Buffer,Length,0); } -int sock::recv(char* Buffer,int MaxToRecv) +int sock::recv(void* Buffer,int MaxToRecv) { - return ::recv(_pp->sfd,Buffer,MaxToRecv,0); + return ::recv(_pp->sfd,(char*)Buffer,MaxToRecv,0); } int sock::getsendtime(int& _out_Second, int& _out_uSecond) diff --git a/gsock.h b/gsock.h index b257d1c..de468d8 100644 --- a/gsock.h +++ b/gsock.h @@ -3,9 +3,8 @@ * Licensed under MIT */ -/** Version: 2.2 Update: 20170815*/ - -#pragma once +#ifndef _gsock_h +#define _gsock_h #include #include @@ -35,8 +34,8 @@ public: /// Return: /// return what send() and recv() call returns. - int send(const char* Buffer,int Length); - int recv(char* Buffer,int MaxToRecv); + int send(const void* Buffer,int Length); + int recv(void* Buffer,int MaxToRecv); int getsendtime(int& _out_Second,int& _out_uSecond); int getrecvtime(int& _out_Second,int& _out_uSecond); @@ -87,3 +86,5 @@ private: /// Net Tools int DNSResolve(const std::string& HostName,std::string& _out_IPStr); + +#endif // _gsock_h