I’m trying to create the multiplayer portion of my game and to do so I need to set one device as a server and one as a client.
I’m using the LUBE lib (see: LUBE for explaination)
Basically what is does is start a udp/tcp (I’ve tried both) server on port 8080 (although I’ve tried dozens of other ports) that accepts all incoming connections.
If the simulator is the server all connections work great; if the device (I’ve tried several) is the server, nothing happens (regardless if it’s connected to the same network or using mobile data)
Any thoughts as to why it might do this; if it didn’t work at all I’d assume it was a bad server implementation, but because it’s only the device that does this it has be stumped
basic overview of my code (simplified a bit)
[lua]slither = require “slither”
require “LUBE”
server = {}
function server.load(port)
local s = lube.udpServer
s:init()
s.handshake = ‘digimongameclient’
s:setPing(true, 5, ‘pingo’)
s:listen(port)
s:accept()
function s.callbacks.connect(clientid)
return clientid
end
function s.callbacks.recv(data, clientid)
d = json.decode(data)
end
function s.callbacks.disconnect(clientid)
return clientid
end
function s.updateF()
s:update(0.01)
end
Runtime:addEventListener(‘enterFrame’, s.updateF)
return s
end
client = {}
function client.load(host,port)
local c = lube.udpClient
c:init()
c.handshake = ‘digimongameclient’
c:setPing(true, 5, ‘pingo’)
success, err = c:connect(host, port, true)
if success then
function c.callbacks.recv(data)
d = json.decode(data)
end
function c.updateF()
c:update(0.01)
end
Runtime:addEventListener(‘enterFrame’,c.updateF)
end
return c
end
–client.obj = client.load(host,port) —sets as client
–server.obj = server.load(port) —sets as server[/lua]
Any and all help will be greatly appreciated!!!
external libs:
LUBE
Slither [import]uid: 8838 topic_id: 26878 reply_id: 326878[/import]