A
adds21
Hello,
I'm writing a PPC application which needs to connect to an instance of SQL
Server if the connection is available.
I can check that the PPC has network access by using the CFNET IPAddress
class, and I could even check the PPC can see a web server by using
HttpWebRequest or something, however I can't find a way to check to see if
the IP Address/machine name I specify in my server connection string is
actually available or not.
I was hoping that I could simply set the timeout in the connection string,
but that doesn't appear to have any effect, and the PPC simply hangs when it
tries to do a SQLConnection.Open if the IP address is non-accessible
(although it correctly accesses it if the server is found).
The problem is, that I can't rely on the fact the PPC is connected to a
network, or can see a web site. It's possible the SQL Server it's going to
try to connect to is in a private (10.x.x.x) network, and if the user moves
between wi-fi hotspots, they'll only be able to connect to the server if
they're connected to the correct network.
A "ping", while not ideal, would at least be one solution. Or I could try
to manually open a Socket to SQL, just to see if it works? Any ideas?
Thanks,
A.
I'm writing a PPC application which needs to connect to an instance of SQL
Server if the connection is available.
I can check that the PPC has network access by using the CFNET IPAddress
class, and I could even check the PPC can see a web server by using
HttpWebRequest or something, however I can't find a way to check to see if
the IP Address/machine name I specify in my server connection string is
actually available or not.
I was hoping that I could simply set the timeout in the connection string,
but that doesn't appear to have any effect, and the PPC simply hangs when it
tries to do a SQLConnection.Open if the IP address is non-accessible
(although it correctly accesses it if the server is found).
The problem is, that I can't rely on the fact the PPC is connected to a
network, or can see a web site. It's possible the SQL Server it's going to
try to connect to is in a private (10.x.x.x) network, and if the user moves
between wi-fi hotspots, they'll only be able to connect to the server if
they're connected to the correct network.
A "ping", while not ideal, would at least be one solution. Or I could try
to manually open a Socket to SQL, just to see if it works? Any ideas?
Thanks,
A.