require"wx" function WRITE(text) textbox:AppendText(text..'\n') end -- prepare the main window frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Connectivity Test", wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE) -- add a textbox to the window textbox = wx.wxTextCtrl(frame, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxTE_MULTILINE + wx.wxTE_READONLY) -- create the layout sizer = wx.wxBoxSizer(wx.wxVERTICAL) sizer:Add(textbox, 1, wx.wxEXPAND) sizer:FitInside(frame) frame:SetSizer(sizer) sizer:RecalcSizes() -- finally, show the frame window frame:Show(true) -- Build the address of the server. address = wx.wxIPV4address() address:Hostname("jabber.org") address:Service(5222) -- Open the connection. sock = wx.wxSocketClient() WRITE('connect: '..tostring(sock:Connect(address))) -- Start talking in XMPP. sock:Write( "".. "") WRITE('reading...') WRITE('wait result: '..tostring(sock:WaitForRead(3))) sock:Close()