sockets?
#6
Here's an example:
Code:
local TCPLink = {}
TCPLink.__index = TCPLink
function TCPLink:new()
   local t = {}
   setmetatable(t, TCPLink)
   local w = Lua__cTCPLink:new_local() -- new_local = Deleted by garbage collector
   tolua.setpeer(w, t)
   w:tolua__set_instance(w)
   return w
end

TCP = TCPLink:new()
if( TCP:Connect("www.mc-server.org", 80) == true ) then
    Log("Sending message")
    TCP:SendMessage("GET http://www.mc-server.org/\n")
end

function TCPLink:ReceivedData( Data, Size )
    Log("Received data: " .. Size )
    String = string.sub( Data, 0, Size )
    Log( String )
end
Reply
Thanks given by:


Messages In This Thread
sockets? - by Dys0n - 02-28-2011, 01:28 AM
RE: sockets? - by Jockie - 02-28-2011, 01:56 AM
RE: sockets? - by Tybor - 02-28-2011, 02:07 AM
RE: sockets? - by FakeTruth - 02-28-2011, 03:18 AM
RE: sockets? - by Dys0n - 02-28-2011, 03:21 AM
RE: sockets? - by FakeTruth - 02-28-2011, 03:59 AM
RE: sockets? - by Dys0n - 02-28-2011, 04:03 AM
RE: sockets? - by Dys0n - 02-28-2011, 05:52 AM



Users browsing this thread: 1 Guest(s)