cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gknierim
Level 6

How to test if IP Address is accessible

I have a custom dialog that allows the user to enter either an IPv4 or IPv6 address. How can I test to see if that IP Address is accessible?

Thanks,
Greg
Labels (1)
0 Kudos
(6) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

What does "accessible" mean for your needs? Does it need to be accessible via broadcast (i.e. does it just need to be on the local network)? Does a particular service need to be up and running and responding? Are there any APIs you can call to check this?
0 Kudos
gknierim
Level 6

Well, I guess that is part of the battle. This will always be on the local network (internal) so I would think that a PING would suffice but it could be that they have that disabled via their firewall settings so I'm not really sure there is a sure way to test if an IP address is "alive". The design is also to let the installer have the choice of going back to edit the IP if one can't be found, or to continue, which in my opinion kind of defeats the purpose of testing it in the first place.

The dialog basically allows the user to specify the IP address of a SQL Server database server.
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

I'm not our SQL Server expert, but that sounds like it would be handled by our SQL dialogs if you're using our SQL support. I guess if you're just trying to check for the existence of the server (as opposed to running actual scripts) they may not be the best fit. Is it worth writing some InstallScript code that connects to the database at that IP address, to verify it's correct, firewall, user permissions and more?
0 Kudos
gknierim
Level 6

I don't need to do anything with server except check its existence with either ipv4 or ipv6 and then store the address in the registry. Also the user could continue without it existing so I just need to know how to query the server. If the server exists doesn't mean that a database will exist.
0 Kudos
gknierim
Level 6

Since I am really wanting to test to see if a database server is online or not, I have a few questions:

1) Is it neccessary to specify an IP address for the server? Meaning, if I specify the computer/instance name will that resolve the IP address for me?

2) If I just need an instance name and use the SQLServerSelect dialog, is there a way to continue past the dialog if it can't connect to it?

Thanks,
Greg
0 Kudos
tyler5
Level 3

function checkIPAddress( svIP )
NUMBER n;
begin
RegDBDisConnectRegistry( 0 ); // in case it's already open
n = RegDBConnectRegistry ( svIP, HKEY_LOCAL_MACHINE, 0 );
RegDBDisConnectRegistry( 0 );
return n;
end;
0 Kudos