net/examples/broadcastingExampleClient.lua
Ryan 4f40bc3dfc Fixed for new multi (2.0.1)
Added Fix for multi 1.7.x
Requires luasocket 3.0+
Added Examples
2017-06-27 11:45:34 -04:00

16 lines
606 B
Lua

package.path="?/init.lua;"..package.path
require("bin")
require("multi")
require("net.aft")
client=net:newCastedClient("Lua_Server") -- searches the lan for this server name
-- Both udp and tcp clients can be broadcasted
client.OnClientReady(function(self)
self:send("Hello!")
end) -- For a tcp client the client is already ready, with udp a small handshake is done and the client is not instantly ready
client.OnDataRecieved(function(self,data) -- thats it clients only have to worry about itself and the server
if data=="Hello Client!" then
print("Server Responded Back!")
end
end)
multi:mainloop()