VR-Forces 4.0.4 Class Documentation
include/vrvCore/DtTcpMessageClient.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2010 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtTcpMessageClient.h,v $ $Revision: 1.20 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #ifndef DtRemoteIGITCPClient_H_
00014 #define DtRemoteIGITCPClient_H_
00015 
00016 #include <vrvCore/vrvCore.h>
00017 #include <vrvUtil/DtMessageClient.h>
00018 #include <vrvUtil/DtMessageStream.h>
00019 #include <vrvCore/DtDeRecord.h>
00020 
00021 #include <string>
00022 
00023 namespace makVrv
00024 {
00025    class DtDe;
00026 
00029    class DT_DLL_VRVCORE DtTcpMessageClient : public DtMessageClient
00030    {
00031    public:
00032 
00034       DtTcpMessageClient( DtDe& de,int socket, const std::string& localAddress, int port );
00035 
00037       ~DtTcpMessageClient();
00038 
00040       virtual void deliver(DtMessage& msg);
00041 
00044       void sendAndFlush();
00045       
00047       virtual void getServerMessages(MessageList&);
00048 
00050       void connectToListener(const std::string& address,int port);
00051 
00053       void disconnect();
00054 
00058       virtual bool validateConnection();
00059 
00061       virtual bool isConnected() const;
00062 
00064       int socket() const;
00065 
00067       virtual int port() const;
00068 
00070       const std::string& address() const;
00071      
00073       void readData();
00074       
00076       bool isOk() const;
00077 
00079       static void getUniqueClientName(std::string& nameOut);
00080 
00082       virtual const std::string& name() const;
00083 
00085       static  std::string errorString(int code);
00086 
00088       const DtDeRecord& connectionRecord();
00089 
00090    protected:
00091 
00092       void setSocket(int socket);
00093 
00096       bool receiveIgRecord(DtDeRecord& name);
00097 
00099 
00100       bool receiveString(std::string& string);
00101       bool receiveInt( int& value);
00102       bool sendString( const std::string& name );
00103       bool sendInt( int value);
00105 
00108       bool sendIGRecord(const DtDeRecord& record);
00109 
00110       
00111       int lastError();
00112 
00114       void getMessagesFromData();     
00115      
00116       DtDe& myDe;
00117 
00118       int mySocket;
00119       std::string myAddress;
00120       int myPort;
00121       bool myOkFlag;
00122 
00123       DtMessageStream myInputStream;
00124       DtMessageStream myOutputStream;
00125       DtDeRecord myRecord;
00126    };
00127 }
00128 
00129 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)