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



Hey that's great info Eugene, thanks for taking the time to help me
investigate this -- I really appreciate it a lot.

I also have reliable UDP working (I use a library called enet which works
great). But for another part of the application, TCP is an absolute
requirement. Port cycling is not an option, as the goal is not to reach the
destination with this packet/stream, but to open up a hole in the firewall
to a known port that the peer can then reach through. If the port changes,
the scheme is defeated.

It's interesting that this works on XP SP2. When I installed XP2 on my
machine, it completely crashed the machine to the point where I had to
reinstall Windows (and and all applications) on a freshly formatted hard
drive, and restore all my data from backup. So I'm running Windows XP SP1.
I get the exception 50 times out of 50. If I leave my code in a loop
(replace "Console.ReadLine" with "Thread.Sleep(200)"), then the connection
succeeds every two minutes -- this must be the timeout on the socket. I
have tried all combinations of ReuseAddress and Linger/DontLinger socket
options.

I wonder why Winsock complains about this consitently in SP1 but not in SP2?
And I wonder if I can grab the SP2 Winsock library and use it instead, even
on SP1 machines.

Greg

"Eugene Gershnik" <gershnik@xxxxxxxxxxx> wrote in message
news:O0sqYI$WFHA.4032@xxxxxxxxxxxxxxxxxxxxxxx
> 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
>
>


.



Relevant Pages

  • RE: windows not activated
    ... I'm not sure why the computer was givin to you to do the updates of SP1 to ... This should have been done automaticly with windows update online. ... Microsoft has devised a disable system to update from SP1 to SP2 ... on pirate bootleg installations. ...
    (microsoft.public.windowsxp.general)
  • Re: Cant Upload Pics From Toshiba PDR3300 Camera
    ... SP2 offers more robust driver and USB support than SP1. ... It would be best if you installed SP2 for Windows XP. ... | The SP2 machine automatically detects the camera and uploading works ...
    (microsoft.public.windowsxp.hardware)
  • Re: XP SP1
    ... ALL I EVER RECEIVE IS SP2 UPDATES. ... SP2 is a recommended update for SP1 Windows XP systems. ... and Then - download and install the FULL version of the Windows XP Service ...
    (microsoft.public.windowsupdate)
  • Re: ActiveX issues
    ... It's an unsigned control. ... Windows xp sp1, Office xp sp2. ...
    (microsoft.public.frontpage.client)