By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

Detect network connection

P: n/a
Hi,

Is there a code snippet or suggestion on how I might detect whether a
computer is connected to a internal network??

Thanks,
Merlin
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
* "Merlin" <iM*****@hotmail.com> scripsit:
Is there a code snippet or suggestion on how I might detect whether a
computer is connected to a internal network??


Maybe using RAS. Some samples in VB Classic:

<http://www.totalenviro.com/PlatformVB>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
Cor
Hi Merlin,

I did try to answer you, but could not find a snippet and forgot to send my
answer..

Using Ping to the central server is the most easy way, I could only not find
a simple piece of code to do that ping, maybe you can Google for that.

Cor
Is there a code snippet or suggestion on how I might detect whether a
computer is connected to a internal network??

Nov 20 '05 #3

P: n/a
Thanks Hertfried and Cor

Very much appreciated.

Merlin

"Merlin" <iM*****@hotmail.com> wrote in message
news:bu*********@hercules.btinternet.com...
Hi,

Is there a code snippet or suggestion on how I might detect whether a
computer is connected to a internal network??

Thanks,
Merlin

Nov 20 '05 #4

P: n/a
bva
I did it the following way

private bool CheckNetwork(

System.Net.IPHostEntry hostInfo
tr

// You can replace the following 2 lines if you can use a fixed servernam
string sServer = Environment.GetEnvironmentVariable("logonserver")
sServer = sServer.Remove(0, 2); //Remove leading "\\" because I only need the servernam
hostInfo = System.Net.Dns.GetHostByName(sServer)
return true;

catc

return false

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.