First steps to switch hedgewars to new net protocol
authorunc0rr
Tue, 15 Jul 2008 16:40:50 +0000
changeset 1081 5be338fa4e2c
parent 1080 8735046fc698
child 1082 596b1dcdc1df
First steps to switch hedgewars to new net protocol
QTfrontend/newnetclient.cpp
netserver/newhwserv.hs
--- a/QTfrontend/newnetclient.cpp	Mon Jul 14 20:24:29 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Tue Jul 15 16:40:50 2008 +0000
@@ -56,7 +56,7 @@
 
 void HWNewNet::JoinGame(const QString & game)
 {
-  RawSendNet(QString("JOIN %1").arg(game));
+  RawSendNet(QString("JOIN%1%2").arg(delimeter).arg(game));
 }
 
 void HWNewNet::AddTeam(const HWTeam & team)
@@ -98,6 +98,7 @@
 
 void HWNewNet::RawSendNet(const QByteArray & buf)
 {
+qDebug() << "Client: " << buf;
   NetSocket.write(buf);
   NetSocket.write("\n", 1);
 }
@@ -142,6 +143,7 @@
 
 void HWNewNet::ParseLine(const QByteArray & line)
 {
+qDebug() << "Server: " << line;
   QString msg = QString::fromUtf8 (line.data(), line.size());
 
   QStringList lst = msg.split(delimeter);
--- a/netserver/newhwserv.hs	Mon Jul 14 20:24:29 2008 +0000
+++ b/netserver/newhwserv.hs	Tue Jul 15 16:40:50 2008 +0000
@@ -17,6 +17,7 @@
 	cChan <- atomically newTChan
 	forkIO $ clientLoop cHandle cChan
 	atomically $ writeTChan acceptChan (ClientInfo cChan cHandle "" 0 "" False)
+	hPutStrLn cHandle "CONNECTED"
 	acceptLoop servSock acceptChan
 
 listenLoop :: Handle -> TChan String -> IO ()