Beispiel #1
0
void SIMServerSocket::activated(int)
{
    if (sock == NULL) return;
    int fd = sock->accept();
    if (fd >= 0){
        log(L_DEBUG, "accept ready");
        if (notify){
            QSocket *s = new QSocket;
            s->setSocket(fd);
            if (notify->accept(new SIMClientSocket(s), htonl(s->address().ip4Addr()))){
                if (notify)
                    notify->m_listener = NULL;
                getSocketFactory()->remove(this);
            }
        }else{
#ifdef WIN32
            ::closesocket(fd);
#else
            ::close(fd);
#endif
        }
    }
}