Home » Community » Newbie corner » Adding a socket to a GUI application
Adding a socket to a GUI application [message #48129] |
Mon, 22 May 2017 10:15 |
Giorgio
Messages: 218 Registered: August 2015
|
Experienced Member |
|
|
Hi there,
I have my application with its GUI that connects to a db and makes stuff. It goes ok. Now I need the ability for the application to listen to a port and, when it receives a specific command, the application needs to modify its behaviour.
My main.cpp is like this
#include <CtrlLib/CtrlLib.h>
#include <Sql/sch_schema.h>
#include <Sql/sch_source.h>
//Other includes
using namespace Upp;
GUI_APP_MAIN
{
String User, Pass, Schema, IP;
int port;
User = "fooo";
Pass = "bar";
Schema = "test";
IP = "192.168.1.2";
port = 3306;
//Connection to the DB
MySqlSession session;
if(err_conn = session.Connect(User, Pass, Schema, IP, port)) {
SQL = session;
SqlSchema sch(MY_SQL);
All_Tables(sch);
}
else {
SetExitCode(1);
}
//Main window of the GUI
HomeScreen hs;
hs.Run();
}
I have no experience in sockets, but my guts tell me that I have to fork somewhere before the .Run() command.
Any suggestion (including links to relevant documentation and RTFM) is appreciated.
Regards,
Gio
|
|
|
Goto Forum:
Current Time: Mon May 06 05:28:33 CEST 2024
Total time taken to generate the page: 0.02671 seconds
|