if (socket == INVALID_SOCKET_VALUE)
{
*iError = EINVAL;
- return -1;
+ return -EINVAL;
}
ssize_t iBytesWritten(0);
if (returnv < 0)
{
*iError = errno;
- return -1;
+ return -errno;
}
else if (returnv == 0)
{
*iError = ETIMEDOUT;
- return -1;
+ return -ETIMEDOUT;
}
returnv = write(socket, (char*)data + iBytesWritten, len - iBytesWritten);
if (returnv == -1)
{
*iError = errno;
- return -1;
+ return -errno;
}
iBytesWritten += returnv;
}
if (socket == INVALID_SOCKET_VALUE)
{
*iError = EINVAL;
- return -1;
+ return -EINVAL;
}
if (iTimeoutMs > 0)
if (returnv == -1)
{
*iError = errno;
- return -1;
+ return -errno;
}
else if (returnv == 0)
{
if (returnv == -1)
{
*iError = errno;
- return -1;
+ return -errno;
}
iBytesRead += returnv;
if (socket == INVALID_SOCKET_VALUE)
{
*iError = EINVAL;
- return -1;
+ return -EINVAL;
}
if (iTimeoutMs > 0)
virtual ssize_t Write(void* data, size_t len)
{
if (!m_socket || !WaitReady())
- return EINVAL;
+ return -EINVAL;
ssize_t iReturn = m_socket->Write(data, len);
MarkReady();
virtual ssize_t Read(void* data, size_t len, uint64_t iTimeoutMs = 0)
{
if (!m_socket || !WaitReady())
- return EINVAL;
+ return -EINVAL;
ssize_t iReturn = m_socket->Read(data, len, iTimeoutMs);
MarkReady();
virtual int GetErrorNumber(void)
{
CLockObject lock(m_mutex);
- return m_socket ? m_socket->GetErrorNumber() : EINVAL;
+ return m_socket ? m_socket->GetErrorNumber() : -EINVAL;
}
virtual CStdString GetName(void)