In the Unix client, stop the program when the read channel finishes.

This commit is contained in:
Ryan Prichard 2011-11-11 23:08:50 -08:00
parent c0c261b2b5
commit f9b713dc57
2 changed files with 8 additions and 0 deletions

View File

@ -27,6 +27,7 @@ UnixClient::UnixClient(QTcpSocket *socket, QObject *parent) :
// Read from TCP.
connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten()));
connect(socket, SIGNAL(readChannelFinished()), SLOT(socketReadFinished()));
}
UnixClient::~UnixClient()
@ -71,6 +72,12 @@ void UnixClient::restoreTerminalMode(termios original)
qFatal("error restoring terminal mode");
}
void UnixClient::socketReadFinished()
{
printf("Connection terminated\r\n");
QCoreApplication::quit();
}
/////////////////////////////////////////////////////////////////////////////
// I/O: client -> server

View File

@ -22,6 +22,7 @@ private:
signals:
private slots:
void socketReadFinished();
void terminalReadActivated();
void socketBytesWritten();
void socketReadyRead();