StorjOld / pyp2p

http://storj.io
MIT License
168 stars 45 forks source link

Add listen + accept logic to hole punching algorithm #9

Closed robertsdotpm closed 8 years ago

robertsdotpm commented 8 years ago

http://www.bford.info/pub/net/p2pnat/index.html Apparently SO_REUSEADDR allows the same local endpoint to be used for connect AND accept which would bypass the problem noted in this paper where sim open can fail for behaviour characteristic 2.

So with SO_REUSEADDR enabled you can just listen on the same endpoint for listen() and connect() and the code will work fine. (Note: BSD will need the SO_REUSEPORT option set though.)