MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / Receive

Method Receive

deps/FtpClient/BlockingSocket.cpp:242–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242int CBlockingSocket::Receive(char* pch, int nSize, int nSecs) const
243{
244 ASSERT( pch != NULL );
245 ASSERT( m_hSocket!=INVALID_SOCKET );
246
247 fd_set fd;
248 FD_ZERO(&fd);
249 FD_SET(m_hSocket, &fd);
250 TIMEVAL tv = { nSecs, 0 };
251
252 // static_cast is necessary to avoid compiler warning under WIN32;
253 // This is no problem because the first parameter is included only
254 // for compatibility with Berkeley sockets.
255 if( _select(m_hSocket+1, &fd, NULL, NULL, &tv)==0 )
256 {
257 throw CBlockingSocketException(_T("Receive timeout"));
258 }
259
260 const int nBytesReceived = recv(m_hSocket, pch, nSize, 0);
261 if( nBytesReceived==SOCKET_ERROR )
262 {
263 throw CBlockingSocketException(_T("Receive"));
264 }
265
266 return nBytesReceived;
267}
268
269int CBlockingSocket::ReceiveDatagram(char* pch, int nSize, LPSOCKADDR psa, int nSecs) const
270{

Callers 2

ReceiveDataMethod · 0.80
GetSingleResponseLineMethod · 0.80

Calls 2

_selectFunction · 0.85

Tested by

no test coverage detected