Re: Re-use an address/port when binding a socket used for Sending data
- From: "Gregory Hassett" <ghassett@xxxxxxxxxxx>
- Date: Thu, 19 May 2005 09:00:23 -0400
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
>
>
.
- Follow-Ups:
- Re: Re-use an address/port when binding a socket used for Sending data
- From: Eugene Gershnik
- Re: Re-use an address/port when binding a socket used for Sending data
- References:
- Re-use an address/port when binding a socket used for Sending data
- From: Gregory Hassett
- Re: Re-use an address/port when binding a socket used for Sending data
- From: Eugene Gershnik
- Re: Re-use an address/port when binding a socket used for Sending data
- From: Gregory Hassett
- Re: Re-use an address/port when binding a socket used for Sending data
- From: Eugene Gershnik
- Re-use an address/port when binding a socket used for Sending data
- Prev by Date: Re: Getting IP and MAC Address
- Next by Date: Re: Re-use an address/port when binding a socket used for Sending data
- Previous by thread: Re: Re-use an address/port when binding a socket used for Sending data
- Next by thread: Re: Re-use an address/port when binding a socket used for Sending data
- Index(es):
Relevant Pages
|