We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当我开启KCP后,我想通过udpClient给多个主机发送消息,但是我发现中途改变hio的目标地址会造成通讯异常。
下面这段代码中,我用定时器定时向服务器发送消息,每次都重新设置sendto的目标地址。但这会造成服务端那边只收到一次消息,后面的消息都收不到。如果不改变sendto的目标地址就不会发生这种情况。
GlobalData::udpClient.loop()->setInterval(3000, [](hv::TimerID timerID) { sockaddr_u target_sockaddr; sockaddr_set_ipport(&target_sockaddr, "服务器地址", 1240); int res = GlobalData::udpClient.sendto("test msg!!!", &(target_sockaddr.sa)); qDebug("send udp res: %d", res); });
如果这个不是bug,那么我是不是要像TCP一样,每次与不同的主机通讯的时候,我都要为每个地址都创建套接字才行。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
当我开启KCP后,我想通过udpClient给多个主机发送消息,但是我发现中途改变hio的目标地址会造成通讯异常。
下面这段代码中,我用定时器定时向服务器发送消息,每次都重新设置sendto的目标地址。但这会造成服务端那边只收到一次消息,后面的消息都收不到。如果不改变sendto的目标地址就不会发生这种情况。
如果这个不是bug,那么我是不是要像TCP一样,每次与不同的主机通讯的时候,我都要为每个地址都创建套接字才行。
The text was updated successfully, but these errors were encountered: