18 #include "connectiontcpclient.h"
21 #include "mutexguard.h"
28 #if ( !defined( _WIN32 ) && !defined( _WIN32_WCE ) ) || defined( __SYMBIAN32__ )
29 # include <sys/types.h>
30 # include <sys/socket.h>
31 # include <sys/select.h>
35 #elif ( defined( _WIN32 ) || defined( _WIN32_WCE ) ) && !defined( __SYMBIAN32__ )
46 const std::string& server,
int port )
52 const std::string& server,
int port )
101 m_server +
": connection refused" );
109 "Unknown error condition" );
129 if( m_cancel || m_socket < 0 )
135 if( !dataAvailable( timeout ) )
141 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
142 int size =
static_cast<int>(
::recv( m_socket, m_buf, m_bufsize, 0 ) );
144 int size =
static_cast<int>(
::recv( m_socket, m_buf, m_bufsize, MSG_DONTWAIT ) );
147 m_totalBytesIn += size;
156 #if defined(__unix__)
157 if( errno == EAGAIN || errno == EWOULDBLOCK )
162 std::string message =
"recv() failed. "
163 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
164 "WSAGetLastError: " + util::int2string( ::WSAGetLastError() );
166 "errno: " + util::int2string( errno ) +
": " + strerror( errno );