Hello! I'm sorry my english can be bad sometimes. I'm having a problem, when
IpAddres ip;
unsigned int port;
objects passed to a
udpSocket.receive(packet, ip, port);
turns out to be == 0
It happens in this part of code(this code lives in while(true) loop)
ClientsVec stores clients with their ip, UdpSocket and port, so that thay can be used further to send and receive data. All the sockets are
.setBlocking(false)
.
As you can see before hitting the line with
receive()
ip is valid.
Than
.receive()
returns whatever but not
Socket::Status::Done
because nothing was sent, so that body stays not executed. And all above is undertandable by me.
But as soon as
.receive()
gets executed:
Also I understand that receive() takes as parameters adresses of Ip and port variables -
.receive(&packet, &Ip, &port);
so it can do whatever it wants with these var-s.
But I can not understand what conditions makes this method reset these variables, and why it happens. Also source code of a UdpSocket is too hard for my to understand, because I'm not experienced.
I will be really happy if someone will give me some advice