void GKSServer::connectSocket() { if (s != NULL) s->disconnectFromHost(); s = this->nextPendingConnection(); connect(s, SIGNAL(readyRead()), this, SLOT(readClient())); connect(s, SIGNAL(disconnected()), this, SLOT(killSocket())); }
/*! Destructor, closes the connection. */ inet::~inet() { net.hub.close("Going down"); net.irc.close("Going down"); if(listenfd) killSocket(listenfd); listenfd = 0; #ifdef HAVE_SSL if(ssl_listenfd) killSocket(ssl_listenfd); ssl_listenfd = 0; #endif for(int i=0; i<max_conns; ++i) conn[i].close("Going down"); resize(); }
void glgrServer::NewConnection() { if (s != NULL) s->disconnectFromHost(); s = this->nextPendingConnection(); s->setReadBufferSize(MY_BUFSIZ); connect(s, SIGNAL(readyRead()), this, SLOT(readClient())); /* used to re-emit the readyRead() signal in case we already missed it at this point; see http://doc.trolltech.com/4.3/qabstractsocket.html#waitForReadyRead or http://doc.trolltech.com/4.3/qiodevice.html#readyRead */ s->waitForReadyRead(); connect(s, SIGNAL(disconnected()), this, SLOT(killSocket())); }