From: lostgallifreyan <los...@gm...> - 2009-10-28 18:29:28
|
I got it! >:) At least, I really think so.... function Main() local IP=wx.wxIPV4address() IP:AnyAddress() IP:Service(80) local SKT=wx.wxSocketServer(IP,wx.wxSOCKET_NONE) print("Socket OK?",SKT:Ok()) FRAME=wx.wxFrame(wx.NULL,-1,"") FRAME:SetSize(432,310) FRAME:Centre() SKT:SetEventHandler(FRAME,wx.wxEVT_SOCKET) SKT:SetNotify(-1,wxSOCKET_CONNECTION_FLAG) SKT:Notify(true) FRAME:Connect(-1,wx.wxEVT_SOCKET,function(E) print("!!!!!") end) FRAME:Show(true) end Main() That lets me know if I connect to the right IP and port. I'm still not exactly sure what prompted me to try exactly this, it was a half-baked interpretatiojn of something in wx.chm, but it WORKS. Question is, is it right? Can it be simplified? Is it formally correct? Please let me know. John (Labensky), you've been silent for a long time, but I'd like you to say something now. I got far enough on my own since Andreas Krink gave me the starting help with a proven example of basic socket access, so havign got here I want to know if I did it the right way. Please let me know if this is missing something I should know, or confirm that it is correct. It obviously works, but I didn't design this system so what works now might not always do so unless it fits with proper methods. Also, is it likely that this business might be simplified in future? I like what appears to be a way to get a lot of versatile control, though I suspect it might be possible to simplify it conceptually, if not in practise. |