Flexiport 2.0.0
Public Member Functions

flexiport::TCPPort Class Reference

TCP implementation of the Port class. More...

#include <flexiport/tcpport.h>

Inheritance diagram for flexiport::TCPPort:
Inheritance graph
[legend]
Collaboration diagram for flexiport::TCPPort:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TCPPort (std::map< std::string, std::string > options)
 ~TCPPort ()
void Open ()
 Open the port.
void Close ()
 Close the port.
ssize_t Read (void *const buffer, size_t count)
 Read from the port.
ssize_t ReadFull (void *const buffer, size_t count)
 Read the requested quantity of data from the port.
ssize_t BytesAvailable ()
 Get the number of bytes waiting to be read at the port. Returns immediatly.
ssize_t BytesAvailableWait ()
 Get the number of bytes waiting after blocking for the timeout.
ssize_t Write (const void *const buffer, size_t count)
 Write data to the port.
void Flush ()
 Flush the port's input and output buffers, discarding all data.
void Drain ()
 Drain the port's input and output buffers.
std::string GetStatus () const
 Get the status of the port (type, device, etc).
void SetTimeout (Timeout timeout)
 Set the timeout value in milliseconds.
void SetCanRead (bool canRead)
 Set the read permissions of the port.
void SetCanWrite (bool canWrite)
 Set the write permissions of the port.
bool IsOpen () const
 Check if the port is open.

Detailed Description

TCP implementation of the Port class.

See the Port class documentation for how to use the common API.

Options
  • ip <string>
    • IP address to connect to. If listen is true, set to "*" to listen on any interface.
    • Default: 127.0.0.1
  • port <integer>
    • TCP port to connect to/listen on.
    • Default: 20000
  • listen
    • Listen on the specified port rather than connecting to it. Other network applications can connect and send data, which will become available as normal.
    • Default: off

Definition at line 61 of file tcpport.h.


Constructor & Destructor Documentation

flexiport::TCPPort::TCPPort ( std::map< std::string, std::string >  options)
flexiport::TCPPort::~TCPPort ( )

Member Function Documentation

ssize_t flexiport::TCPPort::BytesAvailable ( ) [virtual]

Get the number of bytes waiting to be read at the port. Returns immediatly.

Implements flexiport::Port.

ssize_t flexiport::TCPPort::BytesAvailableWait ( ) [virtual]

Get the number of bytes waiting after blocking for the timeout.

Implements flexiport::Port.

void flexiport::TCPPort::Close ( ) [virtual]

Close the port.

Implements flexiport::Port.

void flexiport::TCPPort::Drain ( ) [virtual]

Drain the port's input and output buffers.

Implements flexiport::Port.

void flexiport::TCPPort::Flush ( ) [virtual]

Flush the port's input and output buffers, discarding all data.

Implements flexiport::Port.

std::string flexiport::TCPPort::GetStatus ( ) const [virtual]

Get the status of the port (type, device, etc).

Reimplemented from flexiport::Port.

bool flexiport::TCPPort::IsOpen ( ) const [inline, virtual]

Check if the port is open.

Implements flexiport::Port.

Definition at line 98 of file tcpport.h.

void flexiport::TCPPort::Open ( ) [virtual]

Open the port.

For a listening port, this will call accept() and therefore cause the calling process to block until an incoming connection.

Implements flexiport::Port.

ssize_t flexiport::TCPPort::Read ( void *const  buffer,
size_t  count 
) [virtual]

Read from the port.

Implements flexiport::Port.

ssize_t flexiport::TCPPort::ReadFull ( void *const  buffer,
size_t  count 
) [virtual]

Read the requested quantity of data from the port.

Implements flexiport::Port.

void flexiport::TCPPort::SetCanRead ( bool  canRead) [virtual]

Set the read permissions of the port.

Implements flexiport::Port.

void flexiport::TCPPort::SetCanWrite ( bool  canWrite) [virtual]

Set the write permissions of the port.

Implements flexiport::Port.

void flexiport::TCPPort::SetTimeout ( Timeout  timeout) [virtual]

Set the timeout value in milliseconds.

Implements flexiport::Port.

ssize_t flexiport::TCPPort::Write ( const void *const  buffer,
size_t  count 
) [virtual]

Write data to the port.

Implements flexiport::Port.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Defines