| 218 | } |
| 219 | |
| 220 | bool CBlockingSocket::CheckReadability() const |
| 221 | { |
| 222 | ASSERT( m_hSocket!=INVALID_SOCKET ); |
| 223 | |
| 224 | fd_set fd; |
| 225 | FD_ZERO(&fd); |
| 226 | FD_SET(m_hSocket, &fd); |
| 227 | TIMEVAL tv = { 0, 0 }; |
| 228 | |
| 229 | // static_cast is necessary to avoid compiler warning under WIN32; |
| 230 | // This is no problem because the first parameter is included only |
| 231 | // for compatibility with Berkeley sockets. |
| 232 | const int iRet = _select(m_hSocket+1, &fd, NULL, NULL, &tv); |
| 233 | |
| 234 | if( iRet==SOCKET_ERROR ) |
| 235 | { |
| 236 | throw CBlockingSocketException(_T("Socket Error")); |
| 237 | } |
| 238 | |
| 239 | return iRet == 1; |
| 240 | } |
| 241 | |
| 242 | int CBlockingSocket::Receive(char* pch, int nSize, int nSecs) const |
| 243 | { |
no test coverage detected