-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
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
Why so complicated? #9
Comments
Could you add the |
I think it was as simple as a well-timed |
Well, I found an issue with my approach: it doesn't work on devices without firewalls: The packets will be let through to the kernel, which will notice that no one is listening on that port and then send an RST packet. This is nothing that can't be worked around, but it certainly is annoying. |
I've now combined the approach with a naive listen/accept on a different port. It now requires twice as many connection attempts, but at least it works at all settings. It would be great to have the listener socket on the same port as the |
|
I tried implementing this and only got a lot of really frustrating errors (the
accept
call tends to hang up indefinitely). But I tried a simpler method which does seem to work:SO_REUSEADDR
)You can easily reproduce this with two
nc
commands. There are nolisten
andaccept
calls, making thins a lot easier. The firstconnect
may fail on a firewall, but it will try again and once the peer has sent their first message the packets will go through. It doesn't matter that there is noaccept
call, if both sidesconnect
to each other it works nevertheless. The usual caveats apply: both sides need to synchronize temporally with the precision of one timeout. If any firewall sendsRST
packets, it's game over (this holds especially true on loopback connections on the same machine).My question is: did you try this approach, what do you think of it and how does it compare to the one implemented here? Is there something big that I'm missing (I didn't test with NATs yet for example, but there's no reason it shouldn't work).
The text was updated successfully, but these errors were encountered: