Connecting Tech Pros Worldwide Help | Site Map

How to switch from a Ethernet Adapter to another-LAN to WLAN?

Member
 
Join Date: Oct 2007
Posts: 39
#1: Oct 1 '07
I am trying to familiarize myself with a C++ application which has a bug.

I'd like to have the application connect to WLAN when LAN is not available and vice versa.

Basically, it fails to connect to WLAN when LAN cable is plugged out. Is there a auto mechanism like Network manager which takes care of this? Or do i have to look after this in the code myself? If latter, any tips on how to do it?

Any help is appreciated.

Thanks!
Colloid Snake's Avatar
Familiar Sight
 
Join Date: Nov 2006
Posts: 145
#2: Oct 1 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


Is the application written so that it is supposed to? Are there distinct connections on the box that are being labeled as LAN and WAN (ie, is the app functioning correctly, and can the app function correctly)? If yes to both, I would think the issue is in the program itself.
Member
 
Join Date: Oct 2007
Posts: 39
#3: Oct 3 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


Quote:

Originally Posted by Colloid Snake

Is the application written so that it is supposed to? Are there distinct connections on the box that are being labeled as LAN and WAN (ie, is the app functioning correctly, and can the app function correctly)? If yes to both, I would think the issue is in the program itself.

It is written so... but appearantly not functioning fine. I need to make it work.

There are indeed distinct LAN and WLAN connections.

I wonder where i can find some example code which looks after transferring the connection from LAN to WLAN.. Even learning how to establish a connection over LAN or WLAN should help as well.

Thanks for your help!
Colloid Snake's Avatar
Familiar Sight
 
Join Date: Nov 2006
Posts: 145
#4: Oct 3 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


If it is designed to do that, I would recommend looking at the code - my guess would be that it is in there.
Member
 
Join Date: Oct 2007
Posts: 39
#5: Oct 4 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


Quote:

Originally Posted by Colloid Snake

If it is designed to do that, I would recommend looking at the code - my guess would be that it is in there.

Thanks for your reply, yes the its the code i need to investigate.

I had some progression though. The question now is somewhat different: Say I have got two different Ethernet cards, one for LAN and one for WLAN. How could I determine which of the available connections is actively in use for my application?

Thanks!
sicarie's Avatar
Moderator
 
Join Date: Nov 2006
Location: USA
Posts: 3,929
#6: Oct 4 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


Do a packet capture or windump on the interface while the program is running (and nothing else, just to keep you from getting confused).
Member
 
Join Date: Oct 2007
Posts: 39
#7: Oct 4 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


Quote:

Originally Posted by sicarie

Do a packet capture or windump on the interface while the program is running (and nothing else, just to keep you from getting confused).

I think I need to make a clarification:

say you have got 2 ethernet cards, Wireless and Wire. Program reads these and makes a connection with one of them, say Wire. Then you plug out your cable and would like your application make a new connection with Wireless. then you plug back in your LAN cable and something happens to your Wireless then you would like to make new connection with your LAN again.

BUT

While you are connected using LAN then Wireless is disabled, the program should do nothing at this case - no need to take any action as you were not using Wireless anyway, simple is that.

So the question is during the execution of the code, how can I determine which ethernet is being used? Is it the one in use or not?

Thanks again!
sicarie's Avatar
Moderator
 
Join Date: Nov 2006
Location: USA
Posts: 3,929
#8: Oct 4 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


You can see them in the command line by opening it up (run 'cmd' or opening a terminal window) and then executing the 'ipconfig /all' command on windows or the 'ifconfig' command on Linux. You will see your interfaces as your computer sees them. From here, it seems you need API help with whatever OS you are using to use that to find the interface handles.
Member
 
Join Date: Oct 2007
Posts: 39
#9: Oct 4 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


Quote:

Originally Posted by sicarie

You can see them in the command line by opening it up (run 'cmd' or opening a terminal window) and then executing the 'ipconfig /all' command on windows or the 'ifconfig' command on Linux. You will see your interfaces as your computer sees them. From here, it seems you need API help with whatever OS you are using to use that to find the interface handles.


The program can read the ethernet info and make the relevant the connections if they are enabled/plugged etc.

I need to implement the fail over logic for the interfaces. Say if an interface is down for some reason (cable plugged out, disabled, etc), in that case I just want to detect if the the down interface is the one i was using for connection to the server.

Thanks guys!
Member
 
Join Date: Oct 2007
Posts: 39
#10: Oct 5 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


Can anyone suggest on how to figure out if the LAN cable is connected or not using C++? Like an listener?
Colloid Snake's Avatar
Familiar Sight
 
Join Date: Nov 2006
Posts: 145
#11: Oct 23 '07

re: How to switch from a Ethernet Adapter to another-LAN to WLAN?


What OS are you using?
Reply