Application Server in a Console

Mohd Radzi Ibrahim mradzi at pc.jaring.my
Fri Oct 5 16:06:29 PDT 2007


Hi,
Does EventHandler work in console mode? I was in the impression that  =

it will not work since the event are "windows" event...

--radzi--
On Oct 6, 2007, at 2:55 AM, Mauro Cordon wrote:

> Hi,
>
>    Thanks, I am trying the first suggestion, and it works fine, but  =

> I will try de second suggestion, and I will return if it works.
>
>    Thanks,
>
> 2007/10/5, Liam Whalen < lwhalen at cabletv.on.ca>:
> >  ----- Original Message -----
> > From: Mauro Cordon
> >  To: wx-users at lists.wxwidgets.org
> >  Sent: Friday, October 05, 2007 10:35 AM
> >  Subject: Application Server in a Console
>
> >     I want to create a server of applications, but it must work in a
> > console, but answers the events to the wxSocketBase.
> >     What can I do ? Use wxApp ? What send to SetEventHandler() ?
> >     I use wxGTK and wxMSW.
>
> > From: "Liam Whalen" <lwhalen at cabletv.on.ca>
>
>
> >I'm not sure if there are console specific ways to do this but you  =

> can do
> >it using wxApp.  As far as I can tell you will still need a  =

> wxWindow object
> >to get the event handling properties started.  However >you do not  =

> need to
> >Show() this window, it mearly needs to exist.
>
> Ok ignore my last post.  After looking at my own code I have a much  =

> simpler
> method that does not involve a wxWindow.
>
> In your class that has wxSocketBase inherit from wxEvtHandler.
>
> In your class constructor do the following
>
> this->theSocket->SetEventHandler(*this, SERVER_ID);
>
> //set the event handler
>
> this->Connect( wxEVT_SOCKET,
> wxSocketEventHandler =

> (YourClassWithwxSocketBaseReference::OnServerEvent),
> NULL, this);
>
> This will set up the server to listen for incoming connections.
>
> In your OnServerEvent function you want to create a new socket base  =

> and then
> use this code
>
> theSocketBase->SerEventHandler(*this, SOCKET_ID);
>
> this->Connect( wxEVT_SOCKET,
> wxSocketEventHandler =

> (YourClassWithwxSocketBaseReference::OnSocketEvent ),
> NULL, this );
>
> I think this, as a whole, makes much more sense than using  =

> wxWindows.  It
> seems you have helped me as well with your question.
>
> Liam
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
>
>
> -- =

> Mauro Cordon.=B7.   -)-----
> ---------------------------------------------------------------
> mauro at scordon.com.br - mcordon at usa.com - mcordon at gmail.com
> Linux User #347961     ICQ ID #124551451     Orkut: Mauro Cordon
> "Audaces Fortuna Juvat"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20071006/210=
1efaa/attachment.htm


More information about the wx-users mailing list