Re: Re-use an address/port when binding a socket used for Sending data

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Gregory Hassett wrote:
> Well, for our purposes, we may consider the "packet" that I am
> sending to be a short stream of data.

Not really. You just want to establish a session.

> You can learn about this hole
> punching technique by reading section 4 of the excellent paper at
> http://www.brynosaurus.com/pub/net/p2pnat/

Ok. Note that it plays with things not officially supported by the API so
you cannot complain if something doesn't work.

In any case your code works almost fine on my machine XP SP2, .NET 1.1. If I
keep the Enter continuosly pressed I get your exception once in a while (1
in 50 I'd guess). This suggests that there is some timing problem which may
be platform dependant.

What OS are you using and what version of .NET framework?
The article you linked mentioned that "Windows hosts prior to XP Service
Pack 2, which did not correctly implement simultaneous TCP open". Maybe this
is the problem?

--
Eugene
http://www.gershnik.com


.