How to tell if Computer is connected to Internet
|
|
Thread rating:  |
Steve Long - 28 Nov 2006 17:34 GMT Hello, can someone tell me the quickiest or easiest way to tell if the host computer is connected to the internet? If the computer is connected I want to connect to a SQL Server instance, and do somethign else otherwise.
Thanks in advance for any advice Steve
Bob O`Bob - 28 Nov 2006 19:14 GMT > Hello, can someone tell me the quickiest or easiest way to tell if the host > computer is connected to the internet? If the computer is connected I want > to connect to a SQL Server instance, and do somethign else otherwise. > > Thanks in advance for any advice > Steve Obviously you have to already know how to "connect to a SQL Server instance" so JUST DO IT.
And if that throws an error, then JUST HANDLE IT.
If you are one of those who foolishly think that there's something ""wrong"" with writing code expecting to handle errors, then JUST GET OVER IT.
Bob
 Signature "When you believe in things that you don't understand and you suffer, SUPERSTITION is to blame" - S.Wonder
Steve Long - 28 Nov 2006 23:28 GMT Gee thanks Bob. Next time I want to get yelled at, I'll just e-mail you directly. :) Got 'er handled though. Thanks
S
>> Hello, can someone tell me the quickiest or easiest way to tell if the >> host computer is connected to the internet? If the computer is connected [quoted text clipped - 15 lines] > > Bob MikeD - 29 Nov 2006 00:52 GMT He wasn't yelling at you. He was emphasizing. If he were yelling at you, his entire message would have been in caps. And there's nothing wrong with the advice he gave.
 Signature Mike Microsoft MVP Visual Basic
> Gee thanks Bob. Next time I want to get yelled at, I'll just e-mail you > directly. :) [quoted text clipped - 21 lines] >> >> Bob Paul Clement - 29 Nov 2006 14:47 GMT ¤ He wasn't yelling at you. He was emphasizing. If he were yelling at you, ¤ his entire message would have been in caps. And there's nothing wrong with ¤ the advice he gave.
You guys must know something I don't because I didn't understand the rather crass response.
What does having Internet connectivity have to do with having the ability to connect to SQL Server?
Paul ~~~~ Microsoft MVP (Visual Basic)
Karl E. Peterson - 30 Nov 2006 00:23 GMT > What does having Internet connectivity have to do with having the > ability to connect to SQL Server? Well, the fundamental problem is, there is no single agreed-upon definition of "internet connectivity." Microsoft certainly doesn't provide one. Read that article cited by the cite you passed along, for a deeper understanding. <g> The bottom line is, there's simply no substitute for "try the wire". If you're gonna do that, might as well try hitting the machine you're interested in, eh? I mean, at any given point in time, I may have absolutely no trouble connecting to www.google.com, but www.microsoft.com times-out and acts hijacked. <shrug>
> so JUST DO IT. Aye, sage advice. ;-)
 Signature Working without a .NET? http://classicvb.org/
Bob O`Bob - 30 Nov 2006 06:18 GMT > <g> The bottom line is, there's simply no substitute for "try the wire". > If you're gonna do that, might as well try hitting the machine you're > interested in, eh?
>> so JUST DO IT. > > Aye, sage advice. ;-) It's something I've said, and believed in, all my life. I only wish I'd thought of trademarking it.
Bob --
Steve Long - 30 Nov 2006 15:52 GMT I agree Karl. Heck, it was just a thought... sigh...
S
>> What does having Internet connectivity have to do with having the >> ability to connect to SQL Server? [quoted text clipped - 14 lines] > > Aye, sage advice. ;-) Karl E. Peterson - 30 Nov 2006 18:04 GMT > I agree Karl. Heck, it was just a thought... sigh... Well, to be honest, I don't know what's involved with making a SQL connection. If it is a time-consuming affair in cases where the server isn't available, there may be faster ways to just determine if you can even reach the server. It might depend on it exposing other open ports (http, ftp, etc) though, but the easiest (quickest?) may be a simple code-driven ping (ref: vbnet.mvps.org). There are just so many environments, especially "corporate" nazi-driven ones if ya know what I mean <g>, where testing for "the internet" just loses all rational recognizability, eh?
 Signature Working without a .NET? http://classicvb.org/
Paul Clement - 30 Nov 2006 16:31 GMT ¤ Paul Clement wrote: ¤ > What does having Internet connectivity have to do with having the ¤ > ability to connect to SQL Server? ¤ ¤ Well, the fundamental problem is, there is no single agreed-upon definition ¤ of "internet connectivity." Microsoft certainly doesn't provide one. Read ¤ that article cited by the cite you passed along, for a deeper understanding. ¤ <g> The bottom line is, there's simply no substitute for "try the wire". ¤ If you're gonna do that, might as well try hitting the machine you're ¤ interested in, eh? I mean, at any given point in time, I may have ¤ absolutely no trouble connecting to www.google.com, but www.microsoft.com ¤ times-out and acts hijacked. <shrug>
I guess the point I was trying to make is that you don't need "Internet" connectivity to connect to SQL Server. If that is what the OP was looking for then of course it probably wouldn't be worthwhile to implement.
Paul ~~~~ Microsoft MVP (Visual Basic)
Karl E. Peterson - 30 Nov 2006 18:07 GMT > I guess the point I was trying to make is that you don't need > "Internet" connectivity to connect to SQL Server. I think the fact you needed to put that in quotes says it all. I suppose a time-out's a time-out, huh? I honestly don't know if they're any longer on port 1433 than 80 or 119 or 21 or __...
> If that is what the OP was looking for then of course it probably > wouldn't be worthwhile to implement. Bet he never imagined the can-o-worms he kicked, huh? <g>
 Signature Working without a .NET? http://classicvb.org/
Steve Long - 29 Nov 2006 17:00 GMT Okay, so let me just say why I didn't want to use the approach of trying to connect to SQL Server. It takes longer to try and hit a SQL Server instance than it does to discover if an internet connection is available (my guess). I was using DAO (a legacy application) to connect to SQL Server and there's quite the delay in trying to find the instance if it's not available. So, I was just thinking that it would be quicker to test for an internet connection. So, Bob O' Bob's assumption that I didn't want to write code to trap for an error wasn't really on the mark here. He didn't have the above information so he didn't know that. Plus, I put a smilely face after my "yelling" remark. I really wan't upset at Bob O' Bob as I was trying to show.
Now, Paul's link that he gave me, I found to be quite helpful. It pointed me in a direction that should be useful in more than just this one circumstance and I appreciate that. So, all is well and good on this little square cm of the Earth... :)
Thanks everybody for your help...
Steve
> He wasn't yelling at you. He was emphasizing. If he were yelling at you, > his entire message would have been in caps. And there's nothing wrong with [quoted text clipped - 25 lines] >>> >>> Bob Stefan Berglund - 29 Nov 2006 17:27 GMT in <uobUyf9EHHA.4052@TK2MSFTNGP02.phx.gbl>
>Okay, so let me just say why I didn't want to use the approach of trying to >connect to SQL Server. It takes longer to try and hit a SQL Server instance [quoted text clipped - 7 lines] >"yelling" remark. I really wan't upset at Bob O' Bob as I was trying to >show. I'm not sure if this is your particular problem or not but the Connection Timeout property has no effect or bearing when used on a system that has a named instance and no default instance. IOW, regardless of the timeout setting it will take 20 seconds before returning to the calling program. When there is a default instance, the Connection Timeout property behaves as advertised.
--- This posting is provided "AS IS" with no warranties and no guarantees either express or implied.
Stefan Berglund
Steve Long - 29 Nov 2006 17:38 GMT Hmmm, I did find that but am not sure how to set a default instance.
S
> in <uobUyf9EHHA.4052@TK2MSFTNGP02.phx.gbl> > [quoted text clipped - 28 lines] > > Stefan Berglund Stefan Berglund - 29 Nov 2006 18:26 GMT in <#25u809EHHA.3776@TK2MSFTNGP02.phx.gbl>
>Hmmm, I did find that but am not sure how to set a default instance. When you ~install~ SQL Server you have the option of installing a ~default~ instance or 1 of 15 or 16 ~named~ instances.
--- This posting is provided "AS IS" with no warranties and no guarantees either express or implied.
Stefan Berglund
Steve Long - 29 Nov 2006 19:18 GMT Yeah, yeah. Gotcha now. :) Thanks. Nothing I can do about that at this point.
Steve
> in <#25u809EHHA.3776@TK2MSFTNGP02.phx.gbl> > [quoted text clipped - 8 lines] > > Stefan Berglund Paul Clement - 28 Nov 2006 19:26 GMT ¤ Hello, can someone tell me the quickiest or easiest way to tell if the host ¤ computer is connected to the internet? If the computer is connected I want ¤ to connect to a SQL Server instance, and do somethign else otherwise. ¤
The following should help:
http://vb.mvps.org/samples/project.asp?id=NetConnect
Paul ~~~~ Microsoft MVP (Visual Basic)
Steve Long - 28 Nov 2006 23:31 GMT Thanks Paul. Very helpful
S Hey, I know that guy, Karl... :)
> ¤ Hello, can someone tell me the quickiest or easiest way to tell if the > host [quoted text clipped - 10 lines] > ~~~~ > Microsoft MVP (Visual Basic) Karl E. Peterson - 30 Nov 2006 00:20 GMT > Thanks Paul. Very helpful Thing is, that project pretty much does exactly what Bob suggested. <g>
> Hey, I know that guy, Karl... :) (Peeking under the headers...) Yep, hey Steve! :-)
 Signature Working without a .NET? http://classicvb.org/
|
|
|