>> [...]
>> After this long-winded explanation, does anyone know a server or piece
[quoted text clipped - 24 lines]
>
>Pete
Does the handheld always use the same port for its end of the
connection? If so, another possibility is TCP connection lifetime.
Once a TCP connection (the combination of source IP address,
destination IP address, source port and destination port) is closed,
that connection is unavailable for some period of time, possibly up to
2 minutes, to allow for any delayed packets to arrive.
RobRasti - 04 Apr 2008 09:46 GMT
Thank you for the quick response.
Is the TCP Connection Lifetime something that is configurable on a
network? In our testing environment we have easily sent over 45
transmissions in this manner where in our client's production
environment it seems to exhibit this behavior after a handful of
attempts.
Either way, the handheld does not specify a port when it opens the
TCPClient object. It allows the handheld OS to dynamically open the
local port.
Thank you again for your help.
-R-
I appreciate the feedback. The reason we rotate the ports is because
we have the possibility for over 150 handhelds possibly using this
server simultaneously to send and receive data. It is too much to
manage to have the handhelds assigned an individual port, and we
cannot have the primary port tied up in case another handheld connects
to send or receive data.
All that said, the main connection point for a large portion of the
user bank is a dial-up modem. When the connection is made through the
modem it does not exhibit this behavior. This is something I expect
to happen since the RAS server used resets the connection after the
modems hang up.
Thank you for all your input.
-R-
Paul G. Tobey [eMVP] - 04 Apr 2008 16:19 GMT
I'm afraid that I have to agree that this moving around of the port is
pointless. When you connect to a TCP port which is in the listening state,
if the server accepts your connection a new port *is* assigned, every time,
to the new client. It seems to me that you're just slowing down connections
for no good reason by having the server send back *another* listening port
number for the client to go off and connect to.
Paul T.
>I appreciate the feedback. The reason we rotate the ports is because
> we have the possibility for over 150 handhelds possibly using this
[quoted text clipped - 11 lines]
> Thank you for all your input.
> -R-
Simon Hart [MVP] - 04 Apr 2008 16:53 GMT
I would say this is a bad design. Usually when designing server processes you
listen on one port, when a request comes in you spawn a new thread to service
that client so that the original "listening" thread can continue to block and
accept connections.
How do you manage your firewall for exampe with your current system design.
This sounds a lot like how DCOM works which was a nightmare for admin staff.

Signature
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com
> I appreciate the feedback. The reason we rotate the ports is because
> we have the possibility for over 150 handhelds possibly using this
[quoted text clipped - 11 lines]
> Thank you for all your input.
> -R-
Jack Jackson - 04 Apr 2008 17:35 GMT
>I appreciate the feedback. The reason we rotate the ports is because
>we have the possibility for over 150 handhelds possibly using this
>server simultaneously to send and receive data. It is too much to
>manage to have the handhelds assigned an individual port, and we
>cannot have the primary port tied up in case another handheld connects
>to send or receive data.
The server port won't be tied up. Multiple connections can be using
the same port on the server at the same time.
Peter Duniho - 04 Apr 2008 18:54 GMT
> I appreciate the feedback. The reason we rotate the ports is because
> we have the possibility for over 150 handhelds possibly using this
> server simultaneously to send and receive data. It is too much to
> manage to have the handhelds assigned an individual port, and we
> cannot have the primary port tied up in case another handheld connects
> to send or receive data.
As others have indicated, there is no need to rotate the ports. Having
multiple clients connected on the same server port doesn't consume any
more resources than having them connected on unique ports. In fact, it
consumes _more_ resources to create a new listening port for each client.
Your statement that "we cannot have the primary port tied up" makes no
sense.
In any case, you can easily resolve the initial question -- is this port
rotating behavior tied to the connection refusal behavior? -- by at least
temporarily disabling the port rotation. If the problem persists, then
you can safely ignore the port rotation as a possible cause, even if it is
an ill-advised design.
Pete
RobRasti - 04 Apr 2008 19:40 GMT
I want to thank all of you for your help. I was able to trace down
the issue to a connection attempt being made almost instantaneously
after closing a previous connection. This turned out to be a problem
with the local XP machine and the way it interfaced to with
ActiveSync. I guess the local port was not given time to cycle when
it hit a larger network with more traffic. Adding a LingerOption to
the TCPClient of roughly 5 seconds has cleared up the issue.
Again thank you all for your time.
-R-