Page 29 of 34

Re: LUBE (Networking Library)

Posted: Fri Feb 17, 2012 11:21 pm
by bartbes
Ehm, what client list are you talking about? The current love release doesn't have a numerically indexed one. Is this about a 3rd party library on top of LUBE? Or about your own code? This pretty much tells me nothing.

Re: LUBE (Networking Library)

Posted: Sat Feb 18, 2012 12:21 am
by zipperipper
In LUBE, Server.clients
Once a player disconnects, its removed from the list, but then the client next in the list disconnects after (I think) the ping builds up.
Its an issue with LUBE itself disconnecting clients, has nothing to do with my code.
Im using LUBE version 0.7. if that helps.
edit:
if I disconnect client 1, client 2 and client 3 (and i assume all other clients next in line) will timeout shortly after.

Re: LUBE (Networking Library)

Posted: Sat Feb 18, 2012 10:43 am
by bartbes
I have to wonder why you're using an old version like that, though.
Anyway, the fix seems to be changing ipairs to pairs on line 530.

Re: LUBE (Networking Library)

Posted: Sat Feb 18, 2012 4:30 pm
by zipperipper
I've looked for updated versions but all links I've tried have been 404'd :/

Also yes, that fixed it, thanks :3

Re: LUBE (Networking Library)

Posted: Sat Feb 18, 2012 4:42 pm
by bartbes
The first post has links to 1.0 on github.

Re: LUBE (Networking Library)

Posted: Thu May 03, 2012 6:04 pm
by larios
Hi

im trying to use LUBE 0.7.1 and Löve 0.8

i was putting togheter this simple example, it seems the connection happen, but callback functions dont seem to respond :brows:

is there any obvious mistake here?

Code: Select all

require "LUBE"

mServer = {}
mClient = {}

function love.load()
	port=1234
	ip="127.0.0.1"
	mServer=lube.server(port)
	mServer:setCallback(ServerRcvCallback, ServerConnCallback, ServerDisconnCallback) 
	mServer:setHandshake("Hi!") 
	
	mClient = lube.client() 
	mClient:setHandshake("Hi!") 
	mClient:setCallback(ClientRcvCallback) 
	mClient:connect(ip, port,nil)
	
	mClient:send("test!");
	mServer:send("test!");
	
	print("ok");
end	

function ServerConnCallback(ip, port) 
	print("connected")
	print("Ip: " .. ip)
	print("Port: " .. port)	
end

function ServerRcvCallback(data, ip, port)
	print("Data: " .. data .. " from " .. ip)
end

function ServerDisconnCallback(ip, port)
	print("Ip: " .. ip)
	print("Port: " .. port)	
end

function ClientRcvCallback(data)
	print(data)
end

Re: LUBE (Networking Library)

Posted: Thu May 03, 2012 6:15 pm
by bartbes
Yes, you're not calling their update functions.
I also wonder why you're using on old version.

Re: LUBE (Networking Library)

Posted: Thu May 03, 2012 6:37 pm
by larios
thanks

adding this now works

Code: Select all

function love.update(dt)
	mClient:update(dt)
	mServer:update(dt)
end
was just making some test because i noticed the 1.0 wanted a common class implementation, but ill switch to it

Re: LUBE (Networking Library)

Posted: Mon May 28, 2012 11:49 am
by schme16
I pretty new to using the class libs, as such I'm finding the 1.0 version a little hard to get my head around...

Anyone able to show my how to make a tcp server and a client that connects to it?

(Cheers! in advance)

Re: LUBE (Networking Library)

Posted: Mon May 28, 2012 12:30 pm
by bartbes
You could take a look at this function here: https://github.com/Nevon/cardboard/blob ... n.lua#L181. That code uses hump.class, btw, so you might have to change the class instantiation syntax.