mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
revert
This commit is contained in:
parent
a49d12565d
commit
7092ec0eff
2 changed files with 8 additions and 4 deletions
|
|
@ -1,5 +1,5 @@
|
|||
for i=1,3 do
|
||||
print(string.format("iteration %s", i + 1))
|
||||
print(string.format("iteration %s", i))
|
||||
local text = ""
|
||||
local complete = false
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ for i=1,3 do
|
|||
text = text .. math.random(0, 9)
|
||||
end
|
||||
|
||||
local server = network.tcp_open(7645, function (client)
|
||||
local server = network.tcp_open(9645, function (client)
|
||||
print("client connected")
|
||||
start_coroutine(function()
|
||||
print("client-listener started")
|
||||
|
|
@ -25,7 +25,7 @@ for i=1,3 do
|
|||
end, "client-listener")
|
||||
end)
|
||||
|
||||
network.tcp_connect("localhost", 7645, function (socket)
|
||||
network.tcp_connect("localhost", 9645, function (socket)
|
||||
print("connected to server")
|
||||
start_coroutine(function()
|
||||
print("data-sender started")
|
||||
|
|
|
|||
|
|
@ -607,6 +607,7 @@ public:
|
|||
sockaddr_in address;
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_port = htons(port);
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
if (bind(descriptor, (sockaddr*)&address, sizeof(address)) < 0) {
|
||||
closesocket(descriptor);
|
||||
throw std::runtime_error("could not bind port "+std::to_string(port));
|
||||
|
|
@ -803,7 +804,10 @@ public:
|
|||
}
|
||||
|
||||
void sendTo(const std::string& addr, int port, const char* buffer, size_t length) override {
|
||||
sockaddr_in client = resolve_address_dgram(addr, port);
|
||||
sockaddr_in client{};
|
||||
client.sin_family = AF_INET;
|
||||
inet_pton(AF_INET, addr.c_str(), &client.sin_addr);
|
||||
client.sin_port = htons(port);
|
||||
sendto(descriptor, buffer, length, 0,
|
||||
reinterpret_cast<sockaddr*>(&client), sizeof(client));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue