#include <algorithm> // std::min
-#include <cstdio>
#include <cerrno>
#include <cstring>
#include <cassert>
if (!ReadAll(sock, buffer, strlen(OK_HEADER)))
{
- printf("Receive header answer error: '%s'\n", strerror(errno));
errorMsg = RECV_HEADER_ANSWER_ERROR;
return st_recv_fail;
}
if (!ReadAll(sock, buffer, strlen(OK_LOGIN)))
{
- printf("Receive login answer error: '%s'\n", strerror(errno));
errorMsg = RECV_LOGIN_ANSWER_ERROR;
return st_recv_fail;
}
if (!ReadAll(sock, buffer, strlen(OK_LOGINS)))
{
- printf("Receive secret login answer error: '%s'\n", strerror(errno));
errorMsg = RECV_LOGIN_ANSWER_ERROR;
return st_recv_fail;
}
ssize_t res = read(sock, buffer, sizeof(buffer));
if (res < 0)
{
- printf("Receive data error: '%s'\n", strerror(errno));
errorMsg = RECV_DATA_ANSWER_ERROR;
return st_recv_fail;
}