Select the Connection?

Posted on 2006-05-09
Medium Priority
Last Modified: 2010-04-05

Is it possible, using TCP, to select which network connection to use to send data to a remote server? By this I mean on my PC I can have a LAN connection and a Wireless LAN connection, or have a LAN connection and be connected to the internet on a datacard etc. Is there a way to select the connection I want to use to send the data, without disabling the other connections?

Question by:pixaya
  • 2
LVL 28

Expert Comment

ID: 16638230
well, what is your configureation in respect to HW?
if you have different ip's for all connections then the routing will be the one to decide where the packets will be sent.

that means that if you have an ip of 192.168.x.y on interface 1, and 10.42.42.x on interface 2 and default gateway is set to 192.168.a.b then all packets that are not in the 2 ip classes will be routed to 192.168.a.b by default.

however, you should be able to bind (all network components have a localbind or bindaddress or something similar to whichever interface you want (specifiying the ip) in which case packets will be routed to the default gateway of that interface. I never tried this before as I never needed it (and never had 2 network interfaces either)
if the above does not work and cannot be made to work, then one solution (ugly one) is to temporarely add a route entry (executing "route add ip mask gateway" command in worst case or using api) do the job and then removing the route.

but I guess that since all components have that bind thing, that should work :)

Author Comment

ID: 16639007

Thanks for the info. I kind of figured that if the interfaces had different IP ranges that the right interface would be used depending on the range of the IP I was sending to.

As for the binding I will have a go with that later on.

One thing I'm not so clear on though is say both connections/interfaces (not too sure on the correct terminology) have an internet connection, and the remote IP I want to send the data to is a public IP address running somewhere else in the world, how do make it use one connection rather than the other? Or is this the same scenario as above?

The reason for this question is I would like to be able to use multiple datacards, via external drives, to send the data, there by increasing the amount of data I can send. I'm not even sure if this can be done but I find the idea very interesting and it would be beneficial to a project I am currently working on.
LVL 28

Accepted Solution

2266180 earned 750 total points
ID: 16639810
well .. the thing with the routes will work for sure. but you will have to decide which ip goes to which interface. the binding thing should also work (at least in theory): since you bind to a certain interface (local ip), the connection should always send the data to teh interfaces defautl gateway and in the case that the interface does not have a default gateway assigned, then go to the defautl gateway of the main interface (first interface).
but as I said, this is in theory that I haven't tested. but it should work as I said it.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month17 days, 7 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question