Closed nkbai closed 4 years ago
You need to implement this yourself and do filtering, I don't think there is a way around it.
do you mean that impement another keepalive method myself?
Well, you can either use the existing one provided by the library, and filter out packets coming back, or do an application level keepalive, by trying to reconnect to some node every 24seconds.
for the first way: but there are two problem 1: i can filter packets for comming back, but your keepalive method change the property of the connection, it calls setreaddeadline
that's why i want sending stun request only
the second way is ok, but there is no relation with this keepalive method.
But you can already implement keepalives in your own application, sending a random packet somewhere, or doing it at your protocol level.
if I use the punchd port as a udp server ,a few minutes later, it will fail. it needs a keep alive method. the keepalive method can not cooperate with a server connection, because when keep alive called, this method will send and receive packet. generally , there only one postion for receiving packet!