OnixS C++ FIX Engine 2.79.1.0
C:/Users/Pasha/_Dev/fixforge-cpp/fix/cppEngine/include/OnixS/FIX/TcpClient.h
00001 /*
00002 * Copyright 2005-2011 Onix Solutions Limited [OnixS]. All rights reserved. 
00003 * 
00004 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law 
00005 * and international copyright treaties. 
00006 * 
00007 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
00008 * Services Agreement (the Agreement) and Customer end user license agreements granting 
00009 * a non-assignable, non-transferable and non-exclusive license to use the software 
00010 * for it's own data processing purposes under the terms defined in the Agreement.
00011 * 
00012 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part 
00013 * of this source code or associated reference material to any other location for further reproduction
00014 * or redistribution, and any amendments to this copyright notice, are expressly prohibited. 
00015 *
00016 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with 
00017 * the terms of the Agreement is a violation of copyright law. 
00018 */
00019 
00020 #if !defined(__ONIXS_TCPCLIENT_H__)
00021 #define __ONIXS_TCPCLIENT_H__
00022 
00023 #include <string>
00024 #include <vector>
00025 
00026 #include "OnixS/FIX/ABI.h"
00027 #include "OnixS/FIX/EngineException.h"
00028 
00029 namespace OnixS
00030 {
00031     namespace Sockets
00032     {
00034         class ONIXS_FIXENGINE_API TcpClient
00035         {
00036         public:
00037             
00043             TcpClient(const std::string& hostname, int port, int timeoutInMillisecons = 0);
00044 
00046             TcpClient();
00047 
00049             ~TcpClient(void);
00050 
00056             void connect(const std::string& hostname, int port, int timeoutInMillisecons = 0);
00057 
00059             void close();
00060 
00067             void setNoDelay(bool setTcpNoDelayOption = true);
00068 
00070             bool getNoDelay() const;
00071 
00073             void send(const std::string& value);
00074 
00076             void send(const char* buffer, size_t bufferLength);
00077 
00078             typedef std::vector<char> Bytes;
00079 
00083             const Bytes& receive(int timeoutInMillisecons = 0);
00084 
00089             const Bytes& receive(size_t numberOfBytesToReceive, int timeoutInMillisecons = 0);
00090 
00091         private:    
00092             struct Impl;
00093             Impl* impl_;
00094 
00095             bool isClosed_;
00096         };
00097     }
00098 }
00099 
00100 #endif // __ONIXS_TCPCLIENT_H__