---
title: "Network"
canonical: "https://docs.cuesystem.com/space/CVCHELP/556630069/Network"
format: markdown
---
> Macro (toc)

---

# Ping

This function sends an ICMP request packet to the destination IP on the network and waits for a reply. 

#### Syntax 

```visualbasic
Function Ping(
  serveraddress As Text, 
  Optional repeatcount As Long := 1, 
  Optional timeoutforreply As Time := :2, 
  Optional receivedreplycount As AddressOf Long := Nothing, 
  Optional replyaveragetime As AddressOf Time := Nothing)
As Boolean
```

#### Parameters 

serveraddress 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the domain name or IP address of the destination device on the network 

repeatcount  

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> Optional, number of ICMP request packets sent by the command to the destination device. The valid count is from 1 to 20. 

timeoutforreply  

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, the timeout for ICMP packet replay. 

receivedreplycount  

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> Optional, number of received replies. 

replyaveragetime 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, is the average time between sending a request and receiving a reply.

#### Return value* *

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True if one or more replies were received. Otherwise, the command returns False. It returns False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[88](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#88)</u>, <u>[342](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#342)</u>, <u>[343](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#343)</u>, <u>[344](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#344)</u>, <u>[345](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#345)</u>. 

#### Example 

```visualbasic
Var validreplycount As Long 
Var averagetime As Time 

If Ping("www.google.com",3,:2,validreplycount, averagetime) Then 
  DebugPrintFormat("Ping OK {n}/{n} Average time {:}",validreplycount,3,averagetime) 
Else 
  DebugPrintFormat("Ping Error {n}",GetLastError()) 
End If
```

# WakeOnLAN

This command sends a local magic packet to wake up a specified computer. The command returns True on success or False if an error occurs. The function GetLastError returns the error number that occurred while executing the command. 

The function GetLastError returns the error number that occurred while executing the command. The errors that can happen: <u>[133](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#133)</u>, <u>[134](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#134)</u>, <u>[135](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#135)</u>, <u>[136](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#136)</u>, <u>[137](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#137)</u>, <u>[138](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#138)</u>.  

#### Syntax 

```visualbasic
Function WakeOnLAN( 
  macaddress As Text, 
  Optional password As Text = "") 
As Boolean
```

#### Parameters 

macaddress 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the MAC address of the awake computer. It must be in the followed format: "HH:HH:HH:HH:HH:HH". It is a group of six hex numbers separated by colons that correspond to the MAC address of a network card. 

password  

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is a password. The default value is "" (empty text). Some network cards need a password to wake on. If the password is presented, it must be in the format "HH:HH:HH:HH:HH:HH" (MAC address of the awake computer, the same as the macaddress parameter) or in the format "NN.NN.NN.NN" (IP address of the awake computer). 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. 

#### Example 

```visualbasic
WakeOnLAN("02:0A:05:03:00:01") 
WakeOnLAN("02:0A:05:03:15:01", "02:0A:05:03:15:01") 
WakeOnLAN("02:0A:05:03:15:01", "192.168.3.1")
```