---
title: "TcpRemoteClient (_TcpRemoteClient class)"
canonical: "https://docs.cuesystem.com/space/CVCHELP/522289192/TcpRemoteClient%20(_TcpRemoteClient%20class)"
format: markdown
---
> Macro (toc)

---

# ClearReceiveBuffer

This command works the same way as the TCPClient command[ ](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#ClearReceiveBuffer)<u>[ClearReceiveBuffer.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#ClearReceiveBuffer)</u> 

# Disconnect

This command works the same way as TCPClient command <u>[Disconnect.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#Disconnect)</u> 

# EnableKeepAlivePackets

This command works the same way as the TCPClient command <u>[EnableKeepAlivePackets.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#EnableKeepAlivePackets)</u> 

# GetIpAddress

The command detects the client’s IP address and port. It returns **True** on success or **False** if an error occurs. 

#### Syntax 

```visualbasic
Function GetIpAddress( 
  ByRef clientipaddress As Text, 
  ByRef clientport As Long) 
As Boolean
```

#### Parameters 

clientipaddress 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the address of the remote client. 

clientport 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the port of the remote client. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u>  

**True** on success 

**False** if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The following errors may occur: <u>[91](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#91)</u>. 

#### Example 

```visualbasic
Function TCPServerStart() 
  If TcpServer1.Open(23) = True Then 
    StartProcess TcpClientWorker(TcpServer1.GetClient(1)) 
  End If 
End Function 

Process TcpClientWorker(Client As AddressOf _TcpRemoteClient) 
  Var ClienIpAdd As Text[20] 
  Var ClientPort As Long  
  Var RecvData As ByteString[100] 

  Do While True 
    If Client.WaitForConnect() = True Then 
      Client.Send(&S"I am connected.") 
      Client.GetIpAddress(ClienIpAdd, ClientPort) 
      If Client.Receive(RecvData) = True Then 
        // process answer 
        Client.Send(&S"Reply") 
      End If 
      Client.Disconnect() 
    End If 
  End Do 
End Process
```

# GetMyIpAddress

This command works the same way as the TCPClient command[ ](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#GetMyIpAddress)<u>[GetMyIpAddress.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#GetMyIpAddress)</u> 

# Receive

This command works the same way as the TCPClient command[ ](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#Receive)<u>[Receive.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#Receive)</u> 

# ReceiveAnything

This command works the same way as TCPClient command <u>[ReceiveAnything.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#ReceiveAnything)</u> 

# ReceiveAppend

This command works the same way as the TCPClient command <u>[ReceiveAppend.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#ReceiveAppend)</u> 

# ReceiveFPacket

This command works the same way as TCPClient command <u>[ReceiveFPacket.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#ReceiveFPacket)</u> 

# ReceiveHFPacket

This command works the same way as TCPClient command <u>[ReceiveHFPacket.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#ReceiveHFPacket)</u> 

# ReceiveHLPacket

This command works the same way as TCPClient command <u>ReceiveHLPacket.</u> 

# ReceiveSyncFrame

This command works the same way as the TCPClient command <u>ReceiveSyncFrame.</u> 

# Send

This command works the same way as TCPClient command <u>[Send.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#Send)</u> 

# WaitForConnect

This command waits until a remote client connects to the server. It returns True on success or False if an error occurs. 

#### Syntax 

```visualbasic
Function WaitForConnect(Optional timeout As Time := :10) As Boolean
```

#### Parameters 

timeout 

<u>[Time](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to 10 seconds. It is the timeout. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u>  

**True** on success 

**False** if an error occurs. A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The following errors may occur: <u>[89](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#89)</u>, <u>[99](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#99)</u>, <u>[100](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#100)</u>.  

#### Example 

```visualbasic
Function TCPServerStart() 
  If TcpServer1.Open(23) = True Then 
    StartProcess TcpClientWorker(TcpServer1.GetClient(1)) 
  End If 
End Function 

Process TcpClientWorker(Client As AddressOf _TcpRemoteClient) 
  Var ClienIpAdd As Text[20] 
  Var ClientPort As Long  
  Var RecvData As ByteString[100] 

  Do While True 
    If Client.WaitForConnect() = True Then 
      Client.Send(&S"I am connected.") 
      Client.GetIpAddress(ClienIpAdd, ClientPort) 
      If Client.Receive(RecvData) = True Then 
        // process answer 
        Client.Send(&S"Reply") 
      End If 
      Client.Disconnect() 
    End If 
  End Do 
End Process
```

# WaitForData

This command works the same way as the TCPClient command <u>[WaitForData.](/wiki/spaces/CVCHELP/pages/522289167/TcpClient+TcpClient+class#WaitForData)</u>