Mateusz Czaplinski | 8 May 23:26

Problem with wxSocket

I'm trying to play with wxSocket, but have strange results. The
fragment of code which I attached works perfectly well when run from
wxluaedit.exe (2.8.7.0-MSW-bin) but hangs after displaying the first
message ("connect: true") when run from any other tool (wxlua,
wxluafreeze, also embedded using wxluafreeze).

Could you please help me?
Thanks,
Mateusz Czaplinski
Attachment (test02.lua): application/octet-stream, 1276 bytes
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
wxlua-users mailing list
wxlua-users@...
https://lists.sourceforge.net/lists/listinfo/wxlua-users
John Labenski | 13 May 06:22

Re: Problem with wxSocket

On Thu, May 8, 2008 at 5:30 PM, Mateusz Czaplinski
<czapkofan@...> wrote:
> I'm trying to play with wxSocket, but have strange results. The
>  fragment of code which I attached works perfectly well when run from
>  wxluaedit.exe (2.8.7.0-MSW-bin) but hangs after displaying the first
>  message ("connect: true") when run from any other tool (wxlua,
>  wxluafreeze, also embedded using wxluafreeze).
>

That is strange, what happens if you add a menu item (see minimal
sample or even a button) so that you have to click it before
connecting. I just tried it in Linux and you code works fine for all
three programs. Maybe it's a MSW thing with initializing?

wxLua and wxLuaFreeze, like typical C++ apps, run the Lua code to
create the GUI in the wxApp::OnInit() function which is called before
the mainloop is run. I wonder if this is why wxSocket works in
wxLuaEdit and not the others.

Let me know

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Mateusz Czaplinski | 17 Jun 23:01

Re: Problem with wxSocket

On 5/13/08, John Labenski <jlabenski@...> wrote:
> On Thu, May 8, 2008 at 5:30 PM, Mateusz Czaplinski <czapkofan@...>
> wrote:
>> I'm trying to play with wxSocket, but have strange results. The
>>  fragment of code which I attached works perfectly well when run from
>>  wxluaedit.exe (2.8.7.0-MSW-bin) but hangs after displaying the first
>>  message ("connect: true") when run from any other tool (wxlua,
>>  wxluafreeze, also embedded using wxluafreeze).
>
> That is strange, what happens if you add a menu item (see minimal
> sample or even a button) so that you have to click it before
> connecting? I just tried it in Linux and you code works fine for all
> three programs. Maybe it's a MSW thing with initializing?
>
> wxLua and wxLuaFreeze, like typical C++ apps, run the Lua code to
> create the GUI in the wxApp::OnInit() function which is called before
> the mainloop is run. I wonder if this is why wxSocket works in
> wxLuaEdit and not the others.
>
> Let me know

You're right, it worked when made to run from an event handler of a
button - thanks a lot! It appears it never occured to me to think
about when the Lua code is actually run... and what you write about
that sounds possible, so maybe my problem was because some things in
Wx were not properly initialized yet during this OnInit() method.
And then, if I still want to connect immediately after starting the
program, I suppose I should probably look for some timer or something
similar (sounding like SwingUtils.invokeLater() ;)

(Continue reading)


Gmane