Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long long ServerSocket::recvAll(const int &sock_fd, char *input_buffer,
- std::string &client_msg) {
- long long all_bytes_recv = 0;
- int bytes_read = 0;
- memset(input_buffer, 0, sizeof(input_buffer));
- bytes_read = recv(sock_fd, input_buffer, INPUT_BUFFER_SIZE, 0);
- while (bytes_read > 0) {
- input_buffer[bytes_read] = '\0';
- all_bytes_recv += bytes_read;
- client_msg += input_buffer;
- bytes_read = recv(sock_fd, input_buffer, INPUT_BUFFER_SIZE, 0);
- }
- return all_bytes_recv;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement