In the Unix client, stop the program when the read channel finishes.
This commit is contained in:
parent
c0c261b2b5
commit
f9b713dc57
@ -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
|
||||
|
||||
|
@ -22,6 +22,7 @@ private:
|
||||
signals:
|
||||
|
||||
private slots:
|
||||
void socketReadFinished();
|
||||
void terminalReadActivated();
|
||||
void socketBytesWritten();
|
||||
void socketReadyRead();
|
||||
|
Loading…
Reference in New Issue
Block a user