multi pc tests
This commit is contained in:
parent
c88ad2e73b
commit
291c30a7ac
@ -158,6 +158,7 @@ function multi:newNode(settings)
|
||||
node.name = name
|
||||
node.server = net:newUDPServer(0) -- hosts the node using the default port
|
||||
node.port = node.server.port
|
||||
print(node.port,node.port.udp:getsockname())
|
||||
node.connections = net.ClientCache
|
||||
node.queue = Queue:newQueue()
|
||||
node.functions = bin.stream("RegisteredFunctions.dat",false)
|
||||
@ -330,6 +331,7 @@ function multi:newMaster(settings) -- You will be able to have more than one mas
|
||||
client.OnDataRecieved(function(client,data)
|
||||
local cmd = data:sub(1,1)
|
||||
if cmd == "N" then
|
||||
print(data)
|
||||
local name,ip,port = data:match("(.-)|(.-)|(.+)")
|
||||
local c = net:newUDPClient(ip,port)
|
||||
net.OnCastedClientInfo:Fire(c,name,ip,port)master.connections[name]=c
|
||||
|
||||
4
test.lua
4
test.lua
@ -7,8 +7,8 @@ nGLOBAL = require("multi.integration.networkManager").init()
|
||||
-- Act as a master node
|
||||
master = multi:newMaster{
|
||||
name = "Main", -- the name of the master
|
||||
--noBroadCast = true, -- if using the node manager, set this to true to avoid double connections
|
||||
--managerDetails = {"localhost",12345}, -- the details to connect to the node manager (ip,port)
|
||||
noBroadCast = true, -- if using the node manager, set this to true to avoid double connections
|
||||
managerDetails = {"localhost",12345}, -- the details to connect to the node manager (ip,port)
|
||||
}
|
||||
-- Send to all the nodes that are connected to the master
|
||||
master.OnNodeConnected(function(node)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user