{"action":"created","issue":{"url":"https://api.github.com/repos/RevenantX/LiteNetLib/issues/102","repository_url":"https://api.github.com/repos/RevenantX/LiteNetLib","labels_url":"https://api.github.com/repos/RevenantX/LiteNetLib/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/RevenantX/LiteNetLib/issues/102/comments","events_url":"https://api.github.com/repos/RevenantX/LiteNetLib/issues/102/events","html_url":"https://github.com/RevenantX/LiteNetLib/issues/102","id":261237774,"number":102,"title":"NatPunchModule Reliability","user":{"login":"dt665m","id":11184257,"avatar_url":"https://avatars1.githubusercontent.com/u/11184257?v=4","gravatar_id":"","url":"https://api.github.com/users/dt665m","html_url":"https://github.com/dt665m","followers_url":"https://api.github.com/users/dt665m/followers","following_url":"https://api.github.com/users/dt665m/following{/other_user}","gists_url":"https://api.github.com/users/dt665m/gists{/gist_id}","starred_url":"https://api.github.com/users/dt665m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dt665m/subscriptions","organizations_url":"https://api.github.com/users/dt665m/orgs","repos_url":"https://api.github.com/users/dt665m/repos","events_url":"https://api.github.com/users/dt665m/events{/privacy}","received_events_url":"https://api.github.com/users/dt665m/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-28T08:41:57Z","updated_at":"2017-09-28T09:01:33Z","closed_at":null,"author_association":"NONE","body":"Do you currently use the NatPunch feature in production?  I've written a small client -> server -> client command line demo to test this feature and it doesn't seem to be too reliable at the moment.  I'm running into two issues.  \r\n\r\n1.) Dropped datagrams.   If the two clients receive the HandleNatIntroduction from the server, there is still a chance that the NatPunchMessage will fail to arrive.   Since your demo and the way the NatPunchModule is written is all done with _single_ unreliable datagrams, the chance of a successful punch is very low.\r\n\r\n2.) On Successful NatPunchMessage arrival, if both clients are listening with NatIntroductionSuccess and both try to do client.Connect(Endpoint), sometimes the two clients will get stuck sending each other \"ConnectRequest\" packets and not handle the ConnectAccept message.  I was able to prevent this issue if I only allowed one client to call client.Connect(Endpoint) on successful punch through.  \r\n\r\nIf this is still a demo feature, I'm try to add a few reliability features and provide sample code of it working.  We have some experience doing this with our own library.  Otherwise, I might be attempting to use your library incorrectly and maybe you can give me some feedback.  \r\n\r\nMy proposal is to add another event for \"HandleNatIntroduction\" success so the _application_ can decide how often and how much to send the internal/external punch.  Usually if you get to this point in the negotiations, spamming the punch packet a few times should increase the chance for punch success.  In our experience, the punch packets need to arrive almost at the same time on two clients, so sending just one rarely works in a production environment.\r\n\r\nLet me know what you think!  Thanks sharing such a great library. "},"comment":{"url":"https://api.github.com/repos/RevenantX/LiteNetLib/issues/comments/332774877","html_url":"https://github.com/RevenantX/LiteNetLib/issues/102#issuecomment-332774877","issue_url":"https://api.github.com/repos/RevenantX/LiteNetLib/issues/102","id":332774877,"user":{"login":"dt665m","id":11184257,"avatar_url":"https://avatars1.githubusercontent.com/u/11184257?v=4","gravatar_id":"","url":"https://api.github.com/users/dt665m","html_url":"https://github.com/dt665m","followers_url":"https://api.github.com/users/dt665m/followers","following_url":"https://api.github.com/users/dt665m/following{/other_user}","gists_url":"https://api.github.com/users/dt665m/gists{/gist_id}","starred_url":"https://api.github.com/users/dt665m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dt665m/subscriptions","organizations_url":"https://api.github.com/users/dt665m/orgs","repos_url":"https://api.github.com/users/dt665m/repos","events_url":"https://api.github.com/users/dt665m/events{/privacy}","received_events_url":"https://api.github.com/users/dt665m/received_events","type":"User","site_admin":false},"created_at":"2017-09-28T09:01:33Z","updated_at":"2017-09-28T09:01:33Z","author_association":"NONE","body":"Yes I understand its unreliable by design, our library does something very similar.  I would like to know for your use case, do you have your clients request the NatIntroduction, which will trigger a NatPunch \"N times until giving up\"?\r\n\r\nIn your production experience, how often does this succeed and how big is your \"N\"?"}}
{"actor":{"display_login":"dt665m"}}