# H3DNetworkingUtils::RemoteUDPClient Class Reference

The RemoteUDPClient class starts a Remote client using a UDP port. More...

`#include <H3DNetworkingUtils/RemoteUDPClient.h>`

Inheritance diagram for H3DNetworkingUtils::RemoteUDPClient:

List of all members.

## Public Member Functions
| RemoteUDPClient ()
| Constructor.
virtual | ~RemoteUDPClient ()
| Destructor.
## Static Public Attributes
static const H3D::H3DFloat | PULSE_PERIOD = 1.0
| The period between heartbeats for a UDP socket.
static H3D::H3DNodeDatabase | database
| X3D interface.
## Protected Member Functions
virtual void | sendThisPacket (Packet &packet)
| Send a single packet.
virtual void | restartClient ()
| Restarts the client reading and writing to a new socket.
virtual void | receiveLoop ()
| Wait and receive packets.
virtual void | sendLoop ()
| Send packets. Also send a 'pulse' packet, if no send has happened for a PULSE_PERIOD.
virtual void | requestClose ()
| Request for the connection to close.

## Detailed Description

The RemoteUDPClient class starts a Remote client using a UDP port.

It connects to a given server and port. It has a send loop, receive loop and a 'pulse' loop which tells the server it is still alive. Each loop runs in a different thread. At present, only one remote connection is handled at a time. IMPORTANT NOTE: Do not route from anything in the haptics loop to a remote field if you have periodicSend FALSE. This is because it will then try to send whenever the value changes - i.e. from the haptics loop itself. This will fail. You probably don't want it to interrupt haptics to do socket stuff anyway. Make sure you set periodic send true if you are routing in from the haptics thread. When the client first connects, it sends a pulse packet to the server. The servers responds with a pulse.
Examples:

- RealtimeAttractorTestServer.x3d
- RealtimeAttractorTestClient.x3d

## Member Function Documentation

void RemoteUDPClient::receiveLoop | ( |  | ) | `[protected, virtual]`

Wait and receive packets.

while (true) {

Reimplemented from H3DNetworkingUtils::RemoteConnection.

References H3DNetworkingUtils::RemoteConnection::isConnected, H3DNetworkingUtils::Packet::isHeartBeat(), H3DNetworkingUtils::Packet::receive(), and requestClose().

The documentation for this class was generated from the following files:

- RemoteUDPClient.h
- RemoteUDPClient.cpp