# OpalTransportTCP Class Reference

`#include <transports.h>`

Inheritance diagram for OpalTransportTCP:

[legend]
Collaboration diagram for OpalTransportTCP:
[legend]

## Public Member Functions

Construction
| OpalTransportTCP (OpalEndPoint &endpoint, PIPSocket::Address binding=PIPSocket::GetDefaultIpAny(), WORD port=0, PBoolean reuseAddr=false)
| OpalTransportTCP (OpalEndPoint &endpoint, PChannel *socket)
| ~OpalTransportTCP ()
| Destroy the TCP channel.
Overides from class OpalTransport
virtual PBoolean | IsReliable () const
virtual PBoolean | IsCompatibleTransport (const OpalTransportAddress &address) const
virtual PBoolean | Connect ()
virtual PBoolean | ReadPDU (PBYTEArray &pdu)
virtual PBoolean | WritePDU (const PBYTEArray &pdu)

## Protected Member Functions

virtual const PCaselessString & | GetProtoPrefix () const
bool | OnConnectedSocket (PTCPSocket *socket)

## Protected Attributes

PBoolean | reuseAddressFlag

## Constructor & Destructor Documentation

OpalTransportTCP::OpalTransportTCP | ( | OpalEndPoint & | endpoint,
|  | PIPSocket::Address | binding = `PIPSocket::GetDefaultIpAny()`,
|  | WORD | port = `0`,
|  | PBoolean | reuseAddr = `false` |
| ) |  |  |

Create a new transport channel.

Parameters:

  endpoint | Endpoint object
  binding | Local interface to use
  port | Local port to bind to
  reuseAddr | Flag for binding to already bound interface

OpalTransportTCP::OpalTransportTCP | ( | OpalEndPoint & | endpoint,
|  | PChannel * | socket |
| ) |  |  |

Parameters:

  endpoint | Endpoint object
  socket | Socket to use

OpalTransportTCP::~OpalTransportTCP | ( |  | ) |

Destroy the TCP channel.

## Member Function Documentation

virtual PBoolean OpalTransportTCP::Connect | ( |  | ) | `[virtual]`

Connect to the remote address.

Implements OpalTransport.

virtual const PCaselessString& OpalTransportTCP::GetProtoPrefix | ( |  | ) | const`[protected, virtual]`

Get the prefix for this transports protocol type.

Implements OpalTransportIP.

virtual PBoolean OpalTransportTCP::IsCompatibleTransport | ( | const OpalTransportAddress & | address | ) | const`[virtual]`

Check that the transport address is compatible with transport.

Implements OpalTransport.

virtual PBoolean OpalTransportTCP::IsReliable | ( |  | ) | const`[virtual]`

Get indication of the type of underlying transport.

Implements OpalTransport.

bool OpalTransportTCP::OnConnectedSocket | ( | PTCPSocket * | socket | ) | `[protected]`

virtual PBoolean OpalTransportTCP::ReadPDU | ( | PBYTEArray & | pdu | ) | `[virtual]`

Read a packet from the transport. This will read using the transports mechanism for PDU boundaries, for example UDP is a single Read() call, while for TCP there is a TPKT header that indicates the size of the PDU.

If false is returned but there is data returned in the `packet` that indicates that the available buffer space was too small, e.g. an EMSGSIZE error was returned by recvfrom.

Parameters:

  pdu | PDU read from transport

Implements OpalTransport.

virtual PBoolean OpalTransportTCP::WritePDU | ( | const PBYTEArray & | pdu | ) | `[virtual]`

Write a packet to the transport. This will write using the transports mechanism for PDU boundaries, for example UDP is a single Write() call, while for TCP there is a TPKT header that indicates the size of the PDU.

Parameters:

  pdu | Packet to write

Implements OpalTransport.

## Field Documentation

PBoolean OpalTransportTCP::reuseAddressFlag `[protected]`

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

- transports.h