adroitandroid / Near

A P2P library for Android for discovery on local networks using UDP and transfer in general using TCP sockets
https://goo.gl/kioAiQ
MIT License
350 stars 92 forks source link

Peers update #4

Open AndroFlo opened 7 years ago

AndroFlo commented 7 years ago

Hello,

I make a long scan (many hours) and the ping is every 5000ms. Sometimes i have 0 peers connected sometimes 1 and that chnage evry 2-3 times ping. What are the possibilities that occur ?

Thank's

adroitandroid commented 7 years ago

Hi Audigué, I went through the UDP code, the server will have a timeout interval of 10000ms for your case which will be the delay after receiving a ping at which the stale host Handler will mark the host stale. If the next ping comes fine, after 5 seconds it should work as expected since the handler is reset.

So my guess is that you need to debug in the UdpBroadcastService.BroadcastHandler.broadcast( ) code - there are two unhandled catch blocks and the interfaces enumeration which is where you might want to start.

Also, is this coming only after scanning for a long time or is there a good way I can try to reproduce this scenario?

AndroFlo commented 7 years ago

Thank's for your response. The "problem" is not with a long scan period it can occur the whenever. I will look the UdpBroadcastService.BroadcastHandler.broadcast( )

adroitandroid commented 7 years ago

That's bad! I'll, in all hope, take a look on Sunday

DatL4g commented 5 years ago

Any progress on this issue? Having the same Problem

adroitandroid commented 5 years ago

o dang, never looked into this :|

one guess, just by going through this thread, is that the ping alarms that must be set by the system are not accurate alarms but approximate. So if you are looking/discovering for long, these random deviations might add up to significant enough deviations to skip an interval.