aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/gatscon/clientthread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++-libbu++/src/gatscon/clientthread.cpp')
-rw-r--r--c++-libbu++/src/gatscon/clientthread.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/c++-libbu++/src/gatscon/clientthread.cpp b/c++-libbu++/src/gatscon/clientthread.cpp
new file mode 100644
index 0000000..4c7b72a
--- /dev/null
+++ b/c++-libbu++/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 continue;
34
35 emit recv( pObj );
36 }
37}
38