summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorsenator <senator>2008-03-18 09:18:53 +0000
committersenator <senator>2008-03-18 09:18:53 +0000
commita860976a62d206a1de5aa46f624bcac0036f47c2 (patch)
treed6b3d232a045b887b984b1ad5cd866d93a5768cd /client
parent42f978a143b3bf2b2f8696ef70ccf712ed147350 (diff)
better error handling on socket
Diffstat (limited to 'client')
-rw-r--r--client/sendrecieve.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/client/sendrecieve.cc b/client/sendrecieve.cc
index 914b4af..8d6caf4 100644
--- a/client/sendrecieve.cc
+++ b/client/sendrecieve.cc
@@ -90,10 +90,11 @@ void SendRecieve::makeConnection(QDomDocument *xml_req)
void SendRecieve::myTcpWrite(char *msg, int len)
{
- if(tcpConnected == TCP_CONNECTED)
+ if(tcpConnected == TCP_CONNECTED) {
tcpsocket->write(msg, len);
- else
+ } else {
printf("TCP socket not initialized!\n");
+ }
}
void SendRecieve::myHostFound() // slot
@@ -120,11 +121,18 @@ void SendRecieve::myDisconnected() // slot
has_result = true;
}
-void SendRecieve::myError(QAbstractSocket::SocketError) // slot
+void SendRecieve::myError(QAbstractSocket::SocketError socketError) // slot
{
tcpConnected = TCP_ERROR;
- QMessageBox::information(NULL, tr("Pracro"), tr("Couldn't connect to server.\nPlease contact a system administrator to resolve the problem."));
- exit(1);
+ printf("socket_error: %d\n", socketError);
+ switch (socketError) {
+ case 2 :
+ QMessageBox::information(NULL, tr("Pracro"), tr("Couldn't connect to server.\nPlease contact a system administrator to resolve the problem."));
+ exit(1);
+ break;
+ default :
+ printf("default\n");
+ }
}
void SendRecieve::myReadyReadHandler()