OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
TcpClient.h
Go to the documentation of this file.
1#pragma once
2/*
3* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
4*
5* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
6* and international copyright treaties.
7*
8* Access to and use of the software is governed by the terms of the applicable OnixS Software
9* Services Agreement (the Agreement) and Customer end user license agreements granting
10* a non-assignable, non-transferable and non-exclusive license to use the software
11* for it's own data processing purposes under the terms defined in the Agreement.
12*
13* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
14* of this source code or associated reference material to any other location for further reproduction
15* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
16*
17* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
18* the terms of the Agreement is a violation of copyright law.
19*/
20
21#include <OnixS/FIXEngine/ABI.h>
23
24#include <string>
25
26namespace OnixS {
27namespace Sockets {
30{
31public:
37 TcpClient(const std::string & hostname, int port, int timeoutInMillisecons = 0);
38
41
44
50 void connect(const std::string & hostname, int port, int timeoutInMillisecons = 0);
51
53 void close();
54
61 void noDelay(bool setTcpNoDelayOption);
62
64 bool noDelay() const;
65
67 int receiveBufferSize() const;
68
70 void receiveBufferSize(int size);
71
73 int sendBufferSize() const;
74
76 void sendBufferSize(int size);
77
79
82
84 void send(const std::string & value);
85
87 void send(const void * buffer, size_t bufferLength);
88
92 const Bytes & receive(int timeoutInMillisecons = 0);
93
98 const Bytes & receive(size_t numberOfBytesToReceive, int timeoutInMillisecons = 0);
99
100private:
101 TcpClient(const TcpClient &);
102 TcpClient & operator = (const TcpClient &);
103
104 struct Impl;
105 Impl * impl_;
106};
107}
108}
#define ONIXS_FIXENGINE_API
Definition ABI.h:45
~TcpClient(void)
The destructor.
const Bytes & receive(int timeoutInMillisecons=0)
Receives the data.
void noDelay(bool setTcpNoDelayOption)
Sets a value that disables a delay when send or receive buffers are not full.
TcpClient()
Initializes a new instance of the TcpClient class.
void connect(const std::string &hostname, int port, int timeoutInMillisecons=0)
Connects to the specified port on the specified host.
int receiveBufferSize() const
Returns the size of the TCP buffer allocated to the TCP connection for the receiving data.
void close()
Closes the TCP connection.
void sendBufferSize(int size)
Sets the size of the TCP buffer allocated to the TCP connection for the sending data.
void send(const std::string &value)
Sends the given value.
int sendBufferSize() const
Returns the size of the TCP buffer allocated to the TCP connection for the sending data.
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...
Handle socketHandle()
Returns the socket handle which the TCP connection uses to transmit data.
const Bytes & receive(size_t numberOfBytesToReceive, int timeoutInMillisecons=0)
Receives exactly the given number of bytes.
void receiveBufferSize(int size)
Sets the size of the TCP buffer allocated to the TCP connection for the receiving data.
static const Handle InvalidSocketHandle
Definition TcpClient.h:78
void send(const void *buffer, size_t bufferLength)
Sends the given value.
bool noDelay() const
Gets a value that disables a delay when send or receive buffers are not full.
int Handle
Type alias for socket handle.
Definition Definitions.h:50
std::vector< Byte > Bytes
Sequence of bytes.
Definition Definitions.h:43