sendall now supports string

This commit is contained in:
Kirigaya Kazuto 2018-08-26 00:27:37 +08:00
parent e527e931ff
commit bd3bd376f6
2 changed files with 7 additions and 0 deletions

View File

@ -58,6 +58,12 @@ int sock_helper::sendall(const void* ptr, int datasz)
return sendall(ptr, datasz, x); return sendall(ptr, datasz, x);
} }
int sock_helper::sendall(const std::string& data)
{
int x;
return sendall(data.data(), data.size(), x);
}
int sock_helper::recvall(void* ptr, int length_to_recv) int sock_helper::recvall(void* ptr, int length_to_recv)
{ {
int x; int x;

View File

@ -15,6 +15,7 @@ class sock_helper
public: public:
sock_helper(sock&); sock_helper(sock&);
int sendall(const std::string& data);
int sendall(const void* ptr, int datasz); int sendall(const void* ptr, int datasz);
int sendall(const void* ptr, int datasz, int& bytes_sent); int sendall(const void* ptr, int datasz, int& bytes_sent);