OpenCurves  0.9
RealTimeTcpConnection Class Reference

A RealTimeSource which reads from a TCP socket. More...

#include <realtimetcpconnection.h>

Inheritance diagram for RealTimeTcpConnection:
RealTimeConnection

Public Member Functions

 RealTimeTcpConnection ()
 Create an unconnected TCP connection.
 
 ~RealTimeTcpConnection ()
 Destructor, ensures disconnect() is called.
 
virtual QString name () const override
 The TCP address being used. More...
 
bool open (const QHostAddress &address, quint16 port, uint timeout=5000)
 Open a TCP connection to the indicated address and port. More...
 
virtual bool isConnected () const override
 Is the port open and connected? More...
 
virtual void disconnect () override
 Disconnect if connected.
 
int send (const QByteArray &buffer) override
 Send the given buffer to the source. More...
 
int read (QByteArray &buffer) override
 Read data into the given buffer. More...
 
- Public Member Functions inherited from RealTimeConnection
virtual ~RealTimeConnection ()
 Virtual destructor.
 

Detailed Description

A RealTimeSource which reads from a TCP socket.

Member Function Documentation

virtual bool RealTimeTcpConnection::isConnected ( ) const
overridevirtual

Is the port open and connected?

Returns
True if open.

Implements RealTimeConnection.

virtual QString RealTimeTcpConnection::name ( ) const
overridevirtual

The TCP address being used.

Returns
The TCP connection name.

Implements RealTimeConnection.

bool RealTimeTcpConnection::open ( const QHostAddress &  address,
quint16  port,
uint  timeout = 5000 
)

Open a TCP connection to the indicated address and port.

Closes the existing connection as required.

This function may block for up to the specified timeout, attempting to establish a connection. After this time has elapsed, the connection is deemed to have failed.

Parameters
addressThe target address.
portThe connection port.
timeoutThe connection wait timeout (millisecond).
Returns
True if the connection is successfully established.
int RealTimeTcpConnection::read ( QByteArray &  buffer)
overridevirtual

Read data into the given buffer.

Parameters
bufferThe buffer to read into.

Implements RealTimeConnection.

int RealTimeTcpConnection::send ( const QByteArray &  buffer)
overridevirtual

Send the given buffer to the source.

Parameters
bufferThe buffer to send.

Implements RealTimeConnection.


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