| 358 | |
| 359 | |
| 360 | void cSocket::SetNonBlocking(void) |
| 361 | { |
| 362 | #ifdef _WIN32 |
| 363 | u_long NonBlocking = 1; |
| 364 | int res = ioctlsocket(m_Socket, FIONBIO, &NonBlocking); |
| 365 | #else |
| 366 | int NonBlocking = 1; |
| 367 | int res = ioctl(m_Socket, FIONBIO, (char *)&NonBlocking); |
| 368 | #endif |
| 369 | if (res != 0) |
| 370 | { |
| 371 | LOGERROR("Cannot set socket to non-blocking. This would make the server deadlock later on, aborting.\nErr: %d, %d, %s", |
| 372 | res, GetLastError(), GetLastErrorString().c_str() |
| 373 | ); |
| 374 | abort(); |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | |
| 379 |