Need help here!

  • Thread starter Thread starter Calvin Lai
  • Start date Start date
C

Calvin Lai

Hi all,

Is there any function in c# that allows my program to determine if the
machine is in a network? (either in WAN, LAN, or even wireless? ) thanks.

Calvin
 
Calvin said:
Is there any function in c# that allows my program to determine if the
machine is in a network? (either in WAN, LAN, or even wireless? )
thanks.

No. You can see if another address is pingable, or you can try another
kind of TCP/IP (or another protocol) connection. Bottom line is that the
computer itself does not even know what kind of network it is, all it can
do is try to contact another host and tell you if it could or could not.
I may be misunderstanding your question and reading more into it that you
intend. If so let me know.

You could enumerate the network connection devices (IOW, the installed
adapters), but you will eventually only be able to get very little
information. You _wuold_ find out, though, that there are no network
devices, so that alone would tell you that there is no network. But, you
could have a network adapter, but not have it plugged in, you'd have to
handle that gracefully.

I'm not trying to be mean, but there is no magic variable that tells you
much.

Also, you'd have to use PInvoke thing, because this deals with hardware.

So, post a more precise question, like "How do I know I have Internet
access on the current machine," or "How do I gracefully handle a failed
connection to another host."
 
Back
Top