summaryrefslogtreecommitdiff
path: root/pluginRoutingInterfaceTCP/tcpClient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pluginRoutingInterfaceTCP/tcpClient.cpp')
-rw-r--r--pluginRoutingInterfaceTCP/tcpClient.cpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/pluginRoutingInterfaceTCP/tcpClient.cpp b/pluginRoutingInterfaceTCP/tcpClient.cpp
deleted file mode 100644
index b2aefe3..0000000
--- a/pluginRoutingInterfaceTCP/tcpClient.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * udpClient.cpp
- *
- * Created on: Apr 6, 2011
- * Author: blacky
- */
-
-#include "tcpClient.h"
-#include <iostream>
-
-using namespace std;
-
-tcpClient::tcpClient(QString serverIP_, int serverPort_) {
- serverIP=serverIP_;
- serverPort=serverPort_;
- QObject::connect(this, SIGNAL(connected()), this, SLOT(sendOut()));
-}
-
-tcpClient::~tcpClient() {
- // TODO Auto-generated destructor stub
-}
-
-int tcpClient::connect(int source, int sink) {
-
- sendBuffer.clear();
- sendBuffer.append(QByteArray::number(MSG_CONNECT));
- sendBuffer.append('#');
- sendBuffer.append(QByteArray::number(source));
- sendBuffer.append('#');
- sendBuffer.append(QByteArray::number(sink));
- if (send()) {
- this->waitForReadyRead(CONNECT_TIMEOUT);
- return this->readAll().toInt();
- } else {
- return -1;
- }
-
-}
-
-void tcpClient::system_ready() {
-
- sendBuffer.clear();
- sendBuffer.append(QByteArray::number(SIG_system_ready));
- send();
-}
-
-bool tcpClient::send() {
- QHostAddress adr;
- adr.setAddress(serverIP);
- this->connectToHost(adr,serverPort);
- if (!this->waitForConnected(CONNECT_TIMEOUT)) {
- cout<<"No connection"<<endl;
- return false;
- } else {
- cout<<"got connection"<<endl;
- return true;
- }
-}
-
-void tcpClient::sendOut() {
- this->write(sendBuffer);
-}