diff options
-rw-r--r-- | anyctr.cpp | 5 | ||||
-rw-r--r-- | syncClientSocket.cpp | 12 | ||||
-rw-r--r-- | syncClientSocket.h | 6 |
3 files changed, 17 insertions, 6 deletions
@@ -89,8 +89,11 @@ void createConnection(const std::string & remote_host, u_int16_t remote_port, Co const SyncCommand scom(cl,mux); const SyncCommand scom2 (prefix); oa << scom; - oa << scom2; std::cout << sout.str() << std::endl; + std::ostringstream sout2; + boost::archive::text_oarchive oa2(sout2); + oa2 << scom2; + std::cout << sout2.str() << std::endl; } int main(int argc, char* argv[]) diff --git a/syncClientSocket.cpp b/syncClientSocket.cpp index 734ff6e..40954c4 100644 --- a/syncClientSocket.cpp +++ b/syncClientSocket.cpp @@ -42,17 +42,19 @@ void SyncClientSocket::OnReconnect() void SyncClientSocket::OnRawData(const char *buf,size_t len) //void SyncClientSocket::OnLine(const std::string& line) { - std::stringstream iss; cLog.msg(Log::PRIO_NOTICE) << "recieved sync inforamtaion from " << GetRemoteHostname() << std::endl; for(size_t index=0;index<len;index++) { std::cout << buf[index]; - iss << buf[index]; + iss_ << buf[index]; } - boost::archive::text_iarchive ia(iss); - SyncCommand scom(cl_); - ia >> scom; + while(!iss_.fail()) + { + boost::archive::text_iarchive ia(iss_); + SyncCommand scom(cl_); + ia >> scom; + } //u_int16_t mux = scom.getMux(); //const ConnectionParam & conn = cl_.getConnection(mux)->second; //cLog.msg(Log::PRIO_NOTICE) << "sync connection #"<<mux<<" remote host " << conn.remote_host_ << ":" << conn.remote_port_ << std::endl; diff --git a/syncClientSocket.h b/syncClientSocket.h index 17dd518..1909ebb 100644 --- a/syncClientSocket.h +++ b/syncClientSocket.h @@ -5,6 +5,11 @@ #include "Sockets/ISocketHandler.h" #include "connectionList.h" #include "syncCommand.h" +#include <sstream> +#include <iostream> +#include <string> + + #ifdef SOCKETS_NAMESPACE using namespace SOCKETS_NAMESPACE; @@ -20,6 +25,7 @@ public: void OnRawData(const char *buf,size_t len); private: ConnectionList & cl_; + std::stringstream iss_; }; |