| 193 | } |
| 194 | |
| 195 | int CBlockingSocket::Send(const char* pch, int nSize, int nSecs) const |
| 196 | { |
| 197 | ASSERT( pch != NULL ); |
| 198 | ASSERT( m_hSocket!=INVALID_SOCKET ); |
| 199 | |
| 200 | // returned value will be less than nSize if client cancels the reading |
| 201 | fd_set fd; |
| 202 | FD_ZERO(&fd); |
| 203 | FD_SET(m_hSocket, &fd); |
| 204 | TIMEVAL tv = { nSecs, 0 }; |
| 205 | |
| 206 | if( _select(m_hSocket+1, NULL, &fd, NULL, &tv)==0 ) |
| 207 | { |
| 208 | throw CBlockingSocketException(_T("Send timeout")); |
| 209 | } |
| 210 | |
| 211 | const int nBytesSent = send(m_hSocket, pch, nSize, 0); |
| 212 | if( nBytesSent==SOCKET_ERROR ) |
| 213 | { |
| 214 | throw CBlockingSocketException(_T("Send")); |
| 215 | } |
| 216 | |
| 217 | return nBytesSent; |
| 218 | } |
| 219 | |
| 220 | bool CBlockingSocket::CheckReadability() const |
| 221 | { |
nothing calls this directly
no test coverage detected