TcpClient Class Reference

Provides client connections for TCP network services. More...

List of all members.

Public Types

typedef std::vector< char > Bytes

Public Member Functions

 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.
 TcpClient ()
 Initializes a new instance of the TcpClient class.
 ~TcpClient (void)
 Destructor.
void connect (const std::string &hostname, int port, int timeoutInMillisecons=0)
 Connects to the specified port on the specified host.
void close ()
 Closes the TCP connection.
void setNoDelay (bool setTcpNoDelayOption=true)
 Sets a value that disables a delay when send or receive buffers are not full.
bool getNoDelay () const
 Gets a value that disables a delay when send or receive buffers are not full.
void send (const std::string &value)
 Sends the given value.
void send (const char *buffer, size_t bufferLength)
 Sends the given value.
const Bytesreceive (int timeoutInMillisecons=0)
const Bytesreceive (size_t numberOfBytesToReceive, int timeoutInMillisecons=0)
 Receives exactly the given number of bytes.


Detailed Description

Provides client connections for TCP network services.

Definition at line 20 of file TcpClient.h.


Member Typedef Documentation

typedef std::vector<char> Bytes

Definition at line 69 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:
hostname The DNS name of the remote host to which you intend to connect (or its IP address).
port The port number of the remote host to which you intend to connect.
timeoutInMillisecons 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   ) 

Destructor.


Member Function Documentation

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

Connects to the specified port on the specified host.

Parameters:
hostname The DNS name of the remote host to which you intend to connect (or its IP address).
port The port number of the remote host to which you intend to connect.
timeoutInMillisecons Timeout value in milliseconds. If 0 then the method blocks until some data is received.

void close (  ) 

Closes the TCP connection.

void setNoDelay ( bool  setTcpNoDelayOption = true  ) 

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

When setTcpNoDelayOption is false, a TcpClient does not send a packet over the network until it has collected a significant amount of 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 getNoDelay (  )  const

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

void send ( const std::string &  value  ) 

Sends the given value.

void send ( const char *  buffer,
size_t  bufferLength 
)

Sends the given value.

const Bytes& receive ( int  timeoutInMillisecons = 0  ) 

const Bytes& receive ( size_t  numberOfBytesToReceive,
int  timeoutInMillisecons = 0 
)

Receives exactly the given number of bytes.

Parameters:
numberOfBytesToReceive Number of bytes to received.
timeoutInMillisecons Timeout value in milliseconds. If 0 then the method blocks until all bytes are received.


The documentation for this class was generated from the following file:
Generated on Wed Oct 8 18:59:00 2008 for FIXForge C++ FIX Engine by  doxygen 1.5.2