# H3DNetworkingUtils::RemoteTCPServer Class Reference

The RemoteTCPServer class starts a Remote server using a TCP port. More...

`#include <H3DNetworkingUtils/RemoteTCPServer.h>`

Inheritance diagram for H3DNetworkingUtils::RemoteTCPServer:

List of all members.

## Public Member Functions
| RemoteTCPServer ()
| Constructor.
virtual | ~RemoteTCPServer ()
| Destructor.
## Static Public Attributes
static H3D::H3DNodeDatabase | database
| The X3d interface.
## Protected Member Functions
virtual void | startServer (int port_number)
| Start the server.
virtual void | startReceiving ()
| Start the receiving thread.
virtual void | listeningLoop ()
| This function runs in a new thread, to listen for new connections.
bool | listeningLoopRunning ()
| returns true if the listening loop is running
void | setListeningLoopRunning (bool v)
| Start the listening loop.
void | stopListeningThread ()
| Stop the listening loop.
## Classes
struct | ListenData
| Data for the listening loop to use (A second thread cannot safely read fields used by the graphics thread). More...

## Detailed Description

The RemoteTCPServer class starts a Remote server using a TCP port.

It starts listening on the given port for a connection from a remote client, then continues with the base class's behaviour, using a newly allocate dport for communications. When open is changed from false to true, the listening port is monitored for a connection from a client. When it is changed from true to false, the connection is closed. At present, only one remote connection is handled.
Examples:

- RemoteMFTestServer.x3d
- RemoteMFTestClient.x3d

## Constructor & Destructor Documentation

RemoteTCPServer::~RemoteTCPServer | ( |  | ) | `[virtual]`

Destructor.

if (listening_threadP) { listening_threadP->cancel(); listening_threadP->wait(); listening_threadP = NULL;

}

References listeningLoopRunning().

## Member Function Documentation

void RemoteTCPServer::listeningLoop | ( |  | ) | `[protected, virtual]`

This function runs in a new thread, to listen for new connections.

while (!isShuttingDown()) {

setSendTimeout(sockP, 100);

References H3DNetworkingUtils::RemoteTCPServer::ListenData::port, InetAddr::scanPort(), setListeningLoopRunning(), H3DNetworkingUtils::RemoteConnection::showInfo(), and startReceiving().

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

- RemoteTCPServer.h
- RemoteTCPServer.cpp