MCPcopy Create free account
hub / github.com/Tencent/phxsql / Receive

Method Receive

phxcomm/net/net.cpp:89–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89int NetIO::Receive(const int &fd, string *data) {
90 if (fd < 0)
91 return SOCKET_FAIL;
92
93 char header[1024];
94 int header_len = 4;
95
96 int ret = Receive(fd, header, header_len);
97 if (ret) {
98 return ret;
99 }
100
101 int body_len = 0;
102 memcpy(&body_len, header, 3);
103
104 data->resize(body_len + header_len);
105 memcpy((char *) data->c_str(), header, header_len);
106
107 return Receive(fd, (char *) data->c_str() + header_len, body_len);
108}
109
110int NetIO::Receive(const int &fd, char *buffer, const size_t &buffer_len) {
111 if (fd < 0)

Callers

nothing calls this directly

Calls 1

ColorLogErrorFunction · 0.85

Tested by

no test coverage detected