Example #1
0
/** Returns true if the socket has a read pending */
static bool readWaiting(const SOCKET& sock) {
    int ret = selectOneReadSocket(sock);

    switch (ret) {
    case SOCKET_ERROR:
        logPrintf("ERROR: selectOneReadSocket returned "
                  "SOCKET_ERROR in readWaiting(). %s", socketErrorCode().c_str());
        // Return true so that we'll force an error on read and close
        // the socket.
        return true;

    case 0:
        return false;

    default:
        return true;
    }
}
Example #2
0
/** Returns true if the socket has a read pending */
static bool readWaiting(Log* debugLog, const SOCKET& sock) {
    int ret = selectOneReadSocket(sock);

    switch (ret) {
    case SOCKET_ERROR:
        if (debugLog) {
            debugLog->println("ERROR: selectOneReadSocket returned "
                              "SOCKET_ERROR in readWaiting().");
            debugLog->println(socketErrorCode());
        }
        // Return true so that we'll force an error on read and close
        // the socket.
        return true;

    case 0:
        return false;

    default:
        return true;
    }
}