#include "tcpip.h"
#include "tcpip_server.cpp"
#include "tcpip_client.cpp"
#include <iostream>
//#include <QtDebug>
{
ui.setupUi(this);
connect( ui.pushButtonStartTCPServer, SIGNAL(clicked()), this, SLOT(StartTCPServer()) );
connect( ui.pushButtonStartTCPClient, SIGNAL(clicked()), this, SLOT(StartTCPClient()) );
ui.
listWidgetServer->addItem
(QString("server constructor"));
///works here
}
tcpip::~tcpip()
{
}
void tcpip::StartTCPServer()
{
ui.
listWidgetServer->addItem
(QString("server StartTCPServer"));
// not here
// QApplication::processEvents();
bool ok = true;
QString qstr
= ui.
lineEditTCPIPServerPortServer->text
();
port = qstr.toInt(&ok);
//qDebug()<<" server port "<<port;
ui.lineEditServerStatus->setText("server started");
tcpipThread tcpipThreadStart(ui, port);
tcpipThreadStart.run();
tcpipThreadStart.wait(ULONG_MAX);
}
void tcpip::StartTCPClient()
{
ui.
listWidgetClient->addItem
(QString("client StartTCPClient"));
bool ok = true;
QString qstr
= ui.
lineEditTCPIPServerPortClient->text
();
//QApplication::processEvents();
ushort port = qstr.toInt(&ok);
//qDebug()<<"client port = "<<port;
tcpip_client* p_client = new tcpip_client((int)19999,port,FALSE, ui);
str_client(p_client, ui); /* process the request */
close();
}
}
void tcpip
::currChanged(QWidget*){};
void tcpipThread::run()
{
tcpip_server* p_serv = new tcpip_server((int)19999,port,tcpip_server::str_echo, ui);
qDebug()<<"oops...back from CTOR";
delete p_serv;
}
#include "tcpip.h"
#include "tcpip_server.cpp"
#include "tcpip_client.cpp"
#include <iostream>
//#include <QtDebug>
tcpip::tcpip(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
connect( ui.pushButtonStartTCPServer, SIGNAL(clicked()), this, SLOT(StartTCPServer()) );
connect( ui.pushButtonStartTCPClient, SIGNAL(clicked()), this, SLOT(StartTCPClient()) );
ui.listWidgetServer->addItem(QString("server constructor")); ///works here
}
tcpip::~tcpip()
{
}
void tcpip::StartTCPServer()
{
ui.listWidgetServer->addItem(QString("server StartTCPServer")); // not here
// QApplication::processEvents();
bool ok = true;
QString qstr = ui.lineEditTCPIPServerPortServer->text();
port = qstr.toInt(&ok);
//qDebug()<<" server port "<<port;
ui.lineEditServerStatus->setText("server started");
QApplication::processEvents();
tcpipThread tcpipThreadStart(ui, port);
tcpipThreadStart.run();
tcpipThreadStart.wait(ULONG_MAX);
}
void tcpip::StartTCPClient()
{
ui.listWidgetClient->addItem(QString("client StartTCPClient"));
bool ok = true;
QString qstr = ui.lineEditTCPIPServerPortClient->text();
//QApplication::processEvents();
ushort port = qstr.toInt(&ok);
//qDebug()<<"client port = "<<port;
tcpip_client* p_client = new tcpip_client((int)19999,port,FALSE, ui);
str_client(p_client, ui); /* process the request */
close();
}
}
void tcpip::currChanged(QWidget*){};
void tcpipThread::run()
{
tcpip_server* p_serv = new tcpip_server((int)19999,port,tcpip_server::str_echo, ui);
qDebug()<<"oops...back from CTOR";
delete p_serv;
}
To copy to clipboard, switch view to plain text mode
Bookmarks