OnixS C++ FIX Engine  4.12.0
API Documentation
TcpClient Class Reference

#include <OnixS/FIXEngine/Sockets/TcpClient.h>

Public Member Functions

 TcpClient (const std::string &hostname, int port, int timeoutInMillisecons=0)
 
 TcpClient ()
 
 ~TcpClient (void)
 
void connect (const std::string &hostname, int port, int timeoutInMillisecons=0)
 
void close ()
 
void noDelay (bool setTcpNoDelayOption)
 
bool noDelay () const
 
int receiveBufferSize () const
 
void receiveBufferSize (int size)
 
int sendBufferSize () const
 
void sendBufferSize (int size)
 
Handle socketHandle ()
 
void send (const std::string &value)
 
void send (const void *buffer, size_t bufferLength)
 
const Bytesreceive (int timeoutInMillisecons=0)
 
const Bytesreceive (size_t numberOfBytesToReceive, int timeoutInMillisecons=0)
 

Static Public Attributes

static const Handle InvalidSocketHandle
 

Detailed Description

Definition at line 29 of file TcpClient.h.

Constructor & Destructor Documentation

TcpClient ( const std::string &  hostname,
int  port,
int  timeoutInMillisecons = 0 
)

Initializes a new instance of the TcpClient class and connects to the specified port on the specified host.

Parameters
hostnameThe DNS name of the remote host to which you intend to connect (or its IP address).
portThe port number of the remote host to which you intend to connect.
timeoutInMilliseconsThe timeout value in milliseconds. If 0 then the method blocks until some data is received.
TcpClient ( )

Initializes a new instance of the TcpClient class.

~TcpClient ( void  )

The destructor.

Member Function Documentation

void close ( )

Closes the TCP connection.

void connect ( const std::string &  hostname,
int  port,
int  timeoutInMillisecons = 0 
)

Connects to the specified port on the specified host.

Parameters
hostnameThe DNS name of the remote host to which you intend to connect (or its IP address).
portThe port number of the remote host to which you intend to connect.
timeoutInMilliseconsThe timeout value in milliseconds. If 0 then the method blocks until some data is received.
void noDelay ( bool  setTcpNoDelayOption)

Sets a value that disables a delay when send or receive buffers are not full.

When the setTcpNoDelayOption is false, a TcpClient does not send a packet over the network until it has collected a significant amount of the outgoing data. Because of the amount of overhead in a TCP segment, sending small amounts of data is inefficient. However, situations do exist where you need to send very small amounts of data or expect immediate responses from each packet you send. Your decision should weigh the relative importance of network efficiency versus application requirements.

bool noDelay ( ) const

Gets a value that disables a delay when send or receive buffers are not full.

const Bytes& receive ( int  timeoutInMillisecons = 0)

Receives the data.

Parameters
timeoutInMilliseconsThe timeout value in milliseconds. If 0 then the method blocks until some data is received.
const Bytes& receive ( size_t  numberOfBytesToReceive,
int  timeoutInMillisecons = 0 
)

Receives exactly the given number of bytes.

Parameters
numberOfBytesToReceiveThe number of bytes to received.
timeoutInMilliseconsThe timeout value in milliseconds. If 0 then the method blocks until all bytes are received.
int receiveBufferSize ( ) const

Returns the size of the TCP buffer allocated to the TCP connection for the receiving data.

void receiveBufferSize ( int  size)

Sets the size of the TCP buffer allocated to the TCP connection for the receiving data.

void send ( const std::string &  value)

Sends the given value.

void send ( const void *  buffer,
size_t  bufferLength 
)

Sends the given value.

int sendBufferSize ( ) const

Returns the size of the TCP buffer allocated to the TCP connection for the sending data.

void sendBufferSize ( int  size)

Sets the size of the TCP buffer allocated to the TCP connection for the sending data.

Handle socketHandle ( )

Returns the socket handle which the TCP connection uses to transmit data.

Member Data Documentation

const Handle InvalidSocketHandle
static

Definition at line 78 of file TcpClient.h.


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