mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 14:31:50 +00:00
test
This commit is contained in:
parent
7092ec0eff
commit
d71d18a41c
2 changed files with 4 additions and 2 deletions
|
|
@ -2,12 +2,12 @@ for i = 1, 3 do
|
||||||
print(string.format("iteration %s", i))
|
print(string.format("iteration %s", i))
|
||||||
local complete = false
|
local complete = false
|
||||||
|
|
||||||
local server = network.udp_open(8645 + i, function (address, port, data, srv)
|
local server = network.udp_open(8645, function (address, port, data, srv)
|
||||||
print(string.format("server received %s byte(s) from %s:%s", #data, address, port))
|
print(string.format("server received %s byte(s) from %s:%s", #data, address, port))
|
||||||
srv:send(address, port, "pong")
|
srv:send(address, port, "pong")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
network.udp_connect("localhost", 8645 + i, function (data)
|
network.udp_connect("0.0.0.0", 8645, function (data)
|
||||||
print(string.format("client received %s byte(s) from server", #data))
|
print(string.format("client received %s byte(s) from server", #data))
|
||||||
complete = true
|
complete = true
|
||||||
end, function (socket)
|
end, function (socket)
|
||||||
|
|
|
||||||
|
|
@ -800,6 +800,7 @@ public:
|
||||||
|
|
||||||
callback(id, addrStr, port, buffer.data(), size);
|
callback(id, addrStr, port, buffer.data(), size);
|
||||||
}
|
}
|
||||||
|
logger.info() << "udp clients listener stopped";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -814,6 +815,7 @@ public:
|
||||||
|
|
||||||
void close() override {
|
void close() override {
|
||||||
if (!open) return;
|
if (!open) return;
|
||||||
|
logger.info() << "udp server closed";
|
||||||
open = false;
|
open = false;
|
||||||
shutdown(descriptor, 2);
|
shutdown(descriptor, 2);
|
||||||
closesocket(descriptor);
|
closesocket(descriptor);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue