mirror of
https://github.com/Kiritow/GSock.git
synced 2024-03-22 13:10:51 +08:00
Update socket send,recv interface.
Marco defined instead of pragma once now.
This commit is contained in:
parent
14f0bb0f2f
commit
579036b63e
|
@ -168,14 +168,14 @@ int sock::connect(const std::string& IPStr,int Port)
|
||||||
return ::connect(sfd,(sockaddr*)&saddr,sizeof(saddr));
|
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)
|
int sock::getsendtime(int& _out_Second, int& _out_uSecond)
|
||||||
|
|
11
gsock.h
11
gsock.h
|
@ -3,9 +3,8 @@
|
||||||
* Licensed under MIT
|
* Licensed under MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Version: 2.2 Update: 20170815*/
|
#ifndef _gsock_h
|
||||||
|
#define _gsock_h
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -35,8 +34,8 @@ public:
|
||||||
|
|
||||||
/// Return:
|
/// Return:
|
||||||
/// return what send() and recv() call returns.
|
/// return what send() and recv() call returns.
|
||||||
int send(const char* Buffer,int Length);
|
int send(const void* Buffer,int Length);
|
||||||
int recv(char* Buffer,int MaxToRecv);
|
int recv(void* Buffer,int MaxToRecv);
|
||||||
|
|
||||||
int getsendtime(int& _out_Second,int& _out_uSecond);
|
int getsendtime(int& _out_Second,int& _out_uSecond);
|
||||||
int getrecvtime(int& _out_Second,int& _out_uSecond);
|
int getrecvtime(int& _out_Second,int& _out_uSecond);
|
||||||
|
@ -87,3 +86,5 @@ private:
|
||||||
|
|
||||||
/// Net Tools
|
/// Net Tools
|
||||||
int DNSResolve(const std::string& HostName,std::string& _out_IPStr);
|
int DNSResolve(const std::string& HostName,std::string& _out_IPStr);
|
||||||
|
|
||||||
|
#endif // _gsock_h
|
||||||
|
|
Loading…
Reference in New Issue
Block a user