Carsten A. Arnholm
2014-06-22 22:50:34 UTC
Hi,
I am using wx3.0. I need to create a console application to run on
Raspberry PI receiving TCP/IP messages and I want to use derivatives of
wxTCPServer and wxTCPConnection (at least that is what I am trying).
I am testing under Ubuntu, and I am able to get client/server
connections working fine when both client and server apps are GUI
applications.
But I need the server application to run on Raspberry PI and it should
be a console application. So I have tried to use wxAppConsole as follows
(ioServer is derived from wxTCPServer):
class MyApp: public wxAppConsole
{
public:
virtual bool OnInit();
virtual int OnRun();
private:
ioServer m_server;
};
wxIMPLEMENT_APP_CONSOLE(MyApp);
bool MyApp::OnInit()
{
wxString port = "1234";
m_server.Create(port);
return true;
}
int MyApp::OnRun()
{
cout<<"OnRun"<<endl;
// create event loop
wxEventLoop loop;
// order wxAppConsole to process events
ProcessPendingEvents();
// start created event loop
return loop.Run();
}
Somehow, this does not work, i.e. I am not receiving any connection
requests. What am I missing?
Best regards
Carsten Arnholm
I am using wx3.0. I need to create a console application to run on
Raspberry PI receiving TCP/IP messages and I want to use derivatives of
wxTCPServer and wxTCPConnection (at least that is what I am trying).
I am testing under Ubuntu, and I am able to get client/server
connections working fine when both client and server apps are GUI
applications.
But I need the server application to run on Raspberry PI and it should
be a console application. So I have tried to use wxAppConsole as follows
(ioServer is derived from wxTCPServer):
class MyApp: public wxAppConsole
{
public:
virtual bool OnInit();
virtual int OnRun();
private:
ioServer m_server;
};
wxIMPLEMENT_APP_CONSOLE(MyApp);
bool MyApp::OnInit()
{
wxString port = "1234";
m_server.Create(port);
return true;
}
int MyApp::OnRun()
{
cout<<"OnRun"<<endl;
// create event loop
wxEventLoop loop;
// order wxAppConsole to process events
ProcessPendingEvents();
// start created event loop
return loop.Run();
}
Somehow, this does not work, i.e. I am not receiving any connection
requests. What am I missing?
Best regards
Carsten Arnholm
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users