Page 1 of 1

LUBE networking not working

Posted: Wed Feb 22, 2017 1:23 am
by Blobles
Pretty new to networking and wanted to do some testing with LUBE. Getting no errors at all just nothing is appearing.
It's pretty simple, followed a tutorial and changed a few things to get it working (as the code was wrong on the tutorial - lol) fixed the errors yet no luck on getting it to actually print anything.
Client

Code: Select all

Class = require "libs.class"
require "libs.LUBE"

function onReceive(data)
  
end


function load()
    lube.client:Init() --initialize
    lube.client:setHandshake("Hi!")
    lube.client:setCallback(onRecieve)
    lube.client:connect("127.0.0.1", 25000)
end

function update(dt)
    lube.client:update()
end

function draw()

end

function love.draw()
	local version = 0.1
    love.graphics.print("CLIENT - v"..version, 1, 1)
end
Server

Code: Select all

Class = require "libs.class"
require "libs.LUBE"

function onConnect(ip, port)
	print("Connection from "..ip)
	love.graphics.print("Connection from "..ip)
end

function onReceive(data, ip, port)
  
end

function onDisconnect(ip, port)
  
end

function load()
    lube.server:Init(25000)
    lube.server:setCallback(onReceive, onConnect, onDisconnect)
    lube.server:setHandshake("Hi!")
end

function update(dt)
  lube.server:update(dt)
end

function love.draw()

end
server conf has t.console = true, yet nothing is printing to console!

Re: LUBE networking not working

Posted: Wed Feb 22, 2017 2:55 am
by Positive07
Are you on windows? Try using the lovec.exe executable, if that doesnt work try adding this line to the top of your conf.lua or main.lua

Code: Select all

io.out:setvbuf('no')
Also there has been some updates to LUBE and it's now called Grease so I recommend you update

If that doesn't work maybe you should check the category about Networking in Awesome LÖVE or directly use LuaSocket or Lua-ENet