S_Warrior
asked on
Delphi LAN Problem.
Hello, We have 1 PC with 3 ethernet cards install connected to 3 different networks.
I got an IP address some where on one of my 3 networks, How can I detect using what ethernet card Windows will use to rich the IP address more accurate I want to know the local IP address of the ethernet card on which the remote IP is located.
I got an IP address some where on one of my 3 networks, How can I detect using what ethernet card Windows will use to rich the IP address more accurate I want to know the local IP address of the ethernet card on which the remote IP is located.
ASKER
No, No, My application must detect this automatically.
What are the IP addresses of the three network cards inside your PC?
That would be a first big step in helping!
Are all three IPs static or are they dynamic?
Same subnet?
Same Net? (Bad idea).
Some more information is truly needed here I believe.
John
That would be a first big step in helping!
Are all three IPs static or are they dynamic?
Same subnet?
Same Net? (Bad idea).
Some more information is truly needed here I believe.
John
ASKER
I think u do not understand! I am not trying to find it for my pc I am trying to write an application that will detect it.
open a dos box with cmd
and type
ipconfig /all
and type
ipconfig /all
ASKER
Geert_Gruwez:this is the most stupid's answer I ever got on EE. read the questions.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
If IP address you try to access from the PC is in the same subnet with one of your interfaces then windows will use that interface to reach the IP address.
If IP address you try to access from your PC is in different subnet windows will use first adapter in binding order that have default gateway configured.
If IP address you try to access from your PC is in different subnet windows will use first adapter in binding order that have default gateway configured.
Hello S_Warrior,
bjove is absolutley right. But I thought you umight need some further information. To check wether an ip address resides in a local area network you have to compare the host part of the ip address provided with the host part of the ip address of one network interface, like (ip_provided and subnetMask_interface) = (ip_interface and subnetMask_interface). You can get the ip addresses and subnet masks of all interfaces using the IP Helper API function GetAdaptersInfo (http://msdn.microsoft.com/en-us/library/aa365917(VS.85).aspx). This adapters info table also includes the configured gateways.
Regards,
Tueblo
bjove is absolutley right. But I thought you umight need some further information. To check wether an ip address resides in a local area network you have to compare the host part of the ip address provided with the host part of the ip address of one network interface, like (ip_provided and subnetMask_interface) = (ip_interface and subnetMask_interface). You can get the ip addresses and subnet masks of all interfaces using the IP Helper API function GetAdaptersInfo (http://msdn.microsoft.com/en-us/library/aa365917(VS.85).aspx). This adapters info table also includes the configured gateways.
Regards,
Tueblo
To view your routing table, open up a DOS box, and then type ROUTE PRINT. See if your target network is listed, and if it is, it will tell you what the interface IP would be of the outbound route. If it is not listed, then it will use the default gateway to reach that network host. I suspect that you will probably find that it's going through the interface which has the default gateway set.