aboutsummaryrefslogtreecommitdiff
path: root/src/gatscon/clientthread.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-05-17 01:24:51 +0000
committerMike Buland <eichlan@xagasoft.com>2011-05-17 01:24:51 +0000
commitefcbdb7a0347b4399cbabacf3cbea432eeafb17b (patch)
treed468a9d8e129cba0cef68a09421c0e21c720ede6 /src/gatscon/clientthread.cpp
parent02c60c6720f41bcfc367d02ae4c655b651642991 (diff)
downloadlibgats-efcbdb7a0347b4399cbabacf3cbea432eeafb17b.tar.gz
libgats-efcbdb7a0347b4399cbabacf3cbea432eeafb17b.tar.bz2
libgats-efcbdb7a0347b4399cbabacf3cbea432eeafb17b.tar.xz
libgats-efcbdb7a0347b4399cbabacf3cbea432eeafb17b.zip
Gats::Object now has a strToGats function, it's pretty slick, it takes a string
and produces a fully formed gats tree. Also, gatscon now can interact with a server directly.
Diffstat (limited to 'src/gatscon/clientthread.cpp')
-rw-r--r--src/gatscon/clientthread.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gatscon/clientthread.cpp b/src/gatscon/clientthread.cpp
new file mode 100644
index 0000000..b1dc4d0
--- /dev/null
+++ b/src/gatscon/clientthread.cpp
@@ -0,0 +1,38 @@
1#include "clientthread.h"
2
3#include <bu/tcpsocket.h>
4
5ClientThread::ClientThread( QObject *pParent, const QByteArray &baHost,
6 int iPort ) :
7 QThread( pParent ),
8 baHost( baHost ),
9 iPort( iPort ),
10 gsCli( ssCli )
11{
12}
13
14ClientThread::~ClientThread()
15{
16}
17
18void ClientThread::send( Gats::Object *pObj )
19{
20 gsCli.writeObject( pObj );
21}
22
23void ClientThread::run()
24{
25 ssCli.setStream(
26 new Bu::TcpSocket( baHost.constData(), iPort )
27 );
28
29 while( !ssCli.isEos() )
30 {
31 Gats::Object *pObj = gsCli.readObject();
32 if( pObj == NULL )
33 break;
34
35 emit recv( pObj );
36 }
37}
38