Dictate Packet Routing

J

jgretz

Background:

My program connects to an external web service. Normally this is done
over a high speed lan connection, but in the event that the lan is
down, it supports using 1 or many dial up connections to connect to
the web as well. As a side note, the machine is on a network, so the
lan will always appear to be up, it is the backbone to the external
world that could go down. My program uses the Ping class to determine
if we currently have an available connection, if so it uses it, if
not, it goes through a list of dial up connections and attempts to
dial them. if a dial up connection is successful it will hold onto
that connection for 3 minutes of inactivity before disconnecting.

Problem:

Lets say I have a 5 minute long series of processes. When the first
process executes the lan is down, so we connect to the dial up
connection, process the request, and everything is fine. Next, the lan
comes back up within the 3 minutes time out, so we now effectively
have two live connections to the web. So now I get the second request,
is there any way programatically I can force the packets to route over
the lan and not the dial up? (I know there are outside ways to do this
with metrics, I am looking for code).

Any help would be appreciated.

Thanks,
 
N

Nicholas Paldino [.NET/C# MVP]

I'm curious, why not just disconnect from the dial up connection if you
determine the lan connection is working? If you can dial up to it, surely
you can hang up.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Background:
Lets say I have a 5 minute long series of processes. When the first
process executes the lan is down, so we connect to the dial up
connection, process the request, and everything is fine. Next, the lan
comes back up within the 3 minutes time out, so we now effectively
have two live connections to the web. So now I get the second request,
is there any way programatically I can force the packets to route over
the lan and not the dial up? (I know there are outside ways to do this
with metrics, I am looking for code).

I do not think so, the routing is performed in a lower layer then the one
you have access to.

Question, how do you detect that the lan is down?
As well as how do you know that the lan is back on?
 
L

Laura T.

Launch a command shell that executes "route change" to change the default gw
(0.0.0.0).
Tricky.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top