Class

Network


Description

Enables you to access certain properties of the networking environment. You access the Network module from the System module.

Methods

Name

Parameters

Returns

Shared

IsConnected

Boolean

LookupIPAddress

DNSAddress As String

String

WakeOnLAN

Address As String, MACAddress As String

Method descriptions


Network.IsConnected

IsConnected As Boolean

Returns True if connected to a Network.

This example tests whether the user is connected to the Network.

If System.Network.IsConnected Then
  MessageBox("You're connected to the network.")
Else
  MessageBox("You're not connected to the network.")
End If

Network.LookupIPAddress

LookupIPAddress(DNSAddress As String) As String

Looks up the passed DNS address and returns its IP address as a String.

The following call returns the IP address for the wikipedia.org domain name.

Var s As String
s = System.Network.LookupIPAddress("wikipedia.org")
If s <> "" Then
  MessageBox(s)
Else
  MessageBox("An error occurred")
End If

Network.WakeOnLAN

WakeOnLAN(Address As String, MACAddress As String)

Wakes up a remote computer on the LAN, assuming the computer supports this feature.

You can pass a broadcast address, an IP address, or a MAC address of the machine you want to wake up.

This example wakes up a local computer on the Network.

System.Network.WakeOnLAN("10.0.1.10", "d4:9a:20:c5:76:10")

Notes

The LookupDNSAddress and LookupIPAddress methods return empty strings on errors but return the string that was passed to the function if the address could not be resolved.

Sample code

The following call returns the IP address for Wikipedia.

Var IPAddress As String
IPAddress = System.Network.LookupIPAddress("wikipedia.org")
If IPAddress <> "" Then
  MessageBox(IPAddress)
Else
  MessageBox("An error occurred")
End If

Compatibility

All project types on all supported operating systems.

See also

System module.