sockets?
#4
I already created something for this, and exported it to Lua
Code:
class cTCPLink { public: cTCPLink(); ~cTCPLink(); bool Connect( _cstring a_Address, unsigned int a_Port ); int Send( _cstring a_Data, unsigned int a_Size, int a_Flags = 0 ); int SendMessage( const _cstring a_Message, int a_Flags = 0 ); void CloseSocket(); protected: virtual void ReceivedData( char a_Data[256], int a_Size ) = 0; };

It's not documented anywhere. You basically need to 'extend' it like you extend cPlugin. You need this piece of code for that:
Code:
local TCPLink = {} TCPLink.__index = TCPLink function TCPLink:new() local t = {} setmetatable(t, TCPLink) local w = Lua__cTCPLink:new() tolua.setpeer(w, t) w:tolua__set_instance(w) return w end

Then you can inherit the ReceivedData function like so:
Code:
TCPLink:ReceivedData( Data, Size ) -- Do stuffs with data 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)