Event and/or socket problems

Jonas Bengtsson jonas.b at gmail.com
Thu Jan 24 15:52:36 PST 2008


Thanks Lukasz,

BEGIN_EVENT_TABLE(SocketClient, wxEvtHandler) did the job.

I also managed to get my connect functionality to work. I didn't realize 
from the docs that I had to call Connect() more than once.

Cheers,
  Jonas

Lukasz Michalski wrote:
> On Thursday 24 January 2008, Jonas Bengtsson wrote:
>> Hi all,
>>
>> I'm trying to get to grips with sockets in wxwidgets. I have a few
>> problems:
>>
>> 1) I don't get any events on incoming data or lost connection. I think
>> I've set up everything as I should. The main thing that differs between
>> my test application and the Socket sample seem to be that I don't have a
>> wxWindow/wxFrame but instead create my own class that derives from
>> wxEvtHandler. Perhaps I haven't set up the event handler correctly? Do I
>> need to hook it up to something (besides the socket->SetEventHandler()
>> call)?
> 
> You have error in BEGIN_EVENT_TABLE, you should pass SocketClient,wxEvtHandler 
> there.
> 
>> 2) My other problem is that if the server isn't running (i.e. I can't
>> connect at the beginning) I can't connect when the server is started
>> (I'm doing a while(!socket->WaitOnConnect(1)) loop).
>>
> 
> This is because you did not retry to Connect() in while loop.
> 
> Regards,





More information about the wx-users mailing list