From efcbdb7a0347b4399cbabacf3cbea432eeafb17b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 17 May 2011 01:24:51 +0000 Subject: 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. --- src/gatscon/clientthread.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/gatscon/clientthread.cpp (limited to 'src/gatscon/clientthread.cpp') 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 @@ +#include "clientthread.h" + +#include + +ClientThread::ClientThread( QObject *pParent, const QByteArray &baHost, + int iPort ) : + QThread( pParent ), + baHost( baHost ), + iPort( iPort ), + gsCli( ssCli ) +{ +} + +ClientThread::~ClientThread() +{ +} + +void ClientThread::send( Gats::Object *pObj ) +{ + gsCli.writeObject( pObj ); +} + +void ClientThread::run() +{ + ssCli.setStream( + new Bu::TcpSocket( baHost.constData(), iPort ) + ); + + while( !ssCli.isEos() ) + { + Gats::Object *pObj = gsCli.readObject(); + if( pObj == NULL ) + break; + + emit recv( pObj ); + } +} + -- cgit v1.2.3