Class

# Network

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Enables you to access certain properties of the networking environment. You access the <span class="title-ref">Network</span> module from the `System</api/os/system>` module.

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                       | Parameters                                                                                  | Returns                            | Shared |
|--------------------------------------------|---------------------------------------------------------------------------------------------|------------------------------------|--------|
| `IsConnected<network.isconnected>`         |                                                                                             | `Boolean</api/data_types/boolean>` |        |
| `LookupIPAddress<network.lookupipaddress>` | DNSAddress As `String</api/data_types/string>`                                              | `String</api/data_types/string>`   |        |
| `WakeOnLAN<network.wakeonlan>`             | Address As `String</api/data_types/string>`, MACAddress As `String</api/data_types/string>` |                                    |        |

## Method descriptions

<div id="network.isconnected">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Network.IsConnected

**IsConnected** As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if connected to a <span class="title-ref">Network</span>.
>
> This example tests whether the user is connected to the <span class="title-ref">Network</span>.
>
> ``` xojo
> If System.Network.IsConnected Then
>   MessageBox("You're connected to the network.")
> Else
>   MessageBox("You're not connected to the network.")
> End If
> ```

<div id="network.lookupipaddress">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Network.LookupIPAddress

**LookupIPAddress**(DNSAddress As `String</api/data_types/string>`) As `String</api/data_types/string>`

> Looks up the passed DNS address and returns its IP address as a `String</api/data_types/string>`.
>
> The following call returns the IP address for the wikipedia.org domain name.
>
> ``` xojo
> Var s As String
> s = System.Network.LookupIPAddress("wikipedia.org")
> If Not s.IsEmpty Then
>   MessageBox(s)
> Else
>   MessageBox("An error occurred")
> End If
> ```

<div id="network.wakeonlan">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Network.WakeOnLAN

**WakeOnLAN**(Address As `String</api/data_types/string>`, MACAddress As `String</api/data_types/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 <span class="title-ref">Network</span>.
>
> ``` xojo
> 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.

``` xojo
Var IPAddress As String = System.Network.LookupIPAddress("wikipedia.org")

If Not IPAddress.IsEmpty Then
  MessageBox(IPAddress)
Else
  MessageBox("An error occurred")
End If
```

## Compatibility

|                       |                       |
|-----------------------|-----------------------|
| **Project Types**     | Console, Desktop, Web |
| **Operating Systems** | All                   |

<div class="seealso">

`System</api/os/system>` module.

</div>
