GithubHelp home page GithubHelp logo

rcf-cpp's People

rcf-cpp's Issues

error C2668: 'SF::serialize' : ambiguous call to overloaded function

Hi,Jarl. I have a template instantiation problem, please help me, 3KS.

What steps will reproduce the problem?
1.I have a user defined struct
struct ReportParameter
{
    BOOL    bNormal;
    BOOL    bOverflow;

    BOOL    bUsePort;

    BOOL    bSTM1;
    BOOL    bSTM4;
    BOOL    bSTM16;
    BOOL    bSTM64;

    vector<UINT>        arrayObjectID;
};

struct PeriodicalReport
{
    UINT    nReportNumber;  
    UINT    nReportType;
    UINT    nPeriod;
    UINT    nCreateOn;  
    UINT    nReportStatus;
    UINT    nPeriodicalFlag
    ReportParameter stParameter;
    string  strReportName;
    string  strCreateAt;
    string  strMinTime;
    string  strMaxTime;
};
2.Then I define a outside serialize function
namespace SF {

    inline void serializeBytes(SF::Archive &ar, const void *pbytes, 
const unsigned int cbSize)
    {
        if (ar.isRead())
            dynamic_cast<SF::IStream *>(ar.getIstream())->read
((char *)pbytes, cbSize);
        else if (ar.isWrite())
            dynamic_cast<SF::OStream *>(ar.getOstream())->writeRaw((char *)
pbytes, cbSize);
    }


    template<typename Archive>
        void serialize(Archive &ar,PeriodicalReport& 
periodicalReport)
    {
        serializeBytes(ar, &periodicalReport, offsetof
(PeriodicalReport, stParameter));

        ar  &periodicalReport.stParameter 
            &periodicalReport.strCreateAt 
&periodicalReport.strReportName &periodicalReport.strMinTime 
            &periodicalReport.strMaxTime 
&periodicalReport.nPeriodicalFlag ;
    }

3. And I also have a export dll function
void RCFSERIALIZEAPI SerializePeriodicalReport(PeriodicalReport& 
stPeriodicalReport, string& strBinaryData, UINT& nSize, BOOL bStore)
{
   SerializeObject(stPeriodicalReport, strBinaryData, nSize, bStore);
}

template <class Object>
void SerializeObject(Object& stObject, string& strBinaryData, UINT& nSize, 
BOOL bStore)
{
    if(bStore)
    {
        std::ostringstream os;
        SF::OBinaryStream ostr(os);
        ostr << stObject;
        strBinaryData = os.str();
        nSize = strBinaryData.length();
    }
    else
    {
        std::istringstream is(strBinaryData);
        SF::IBinaryStream istr(is);
        istr >> stObject;
    }
}

At Last, I build my project, get following errors:

d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(334) : error 
C2668: 'SF::serialize' : ambiguous call to overloaded function
1>        d:\d(work)\iamsvc9\src\server\include\rcfserializesplitsec.h
(248): could be 'void SF::serialize<SF::Archive>(Archive 
&,PeriodicalReport &)'
1>        with
1>        [
1>            Archive=SF::Archive
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(320): 
or       'void SF::serialize<T>(SF::Archive &,T &)'
1>        with
1>        [
1>            T=U
1>        ]
1>        while trying to match the argument list '(SF::Archive, U)'
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(345) : see 
reference to function template instantiation 'void SF::serialize_vc6<U>
(SF::Archive &,T &,const unsigned int)' being compiled
1>        with
1>        [
1>            T=U
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(425) : see 
reference to function template instantiation 'void SF::preserialize<T>
(SF::Archive &,T *&,const unsigned int)' being compiled
1>        with
1>        [
1>            T=T
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(424) : 
while compiling class template member function 'void 
SF::Serializer<T>::serializeContents(SF::Archive &)'
1>        with
1>        [
1>            T=T
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(175) : see 
reference to class template instantiation 'SF::Serializer<T>' being 
compiled
1>        with
1>        [
1>            T=T
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(200) : see 
reference to function template instantiation 'void 
SF::invokeCustomSerializer<T>(T **,SF::Archive &,int)' being compiled
1>        with
1>        [
1>            T=T
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(222) : see 
reference to function template instantiation 'void 
SF::invokeSerializer<U,T>(U *,T *,boost::mpl::int_<N> *,const U 
&,SF::Archive &)' being compiled
1>        with
1>        [
1>            U=const PeriodicalReport *,
1>            T=T,
1>            N=1
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(232) : see 
reference to function template instantiation 'void SF::invokeSerializer<U>
(U,SF::Archive &)' being compiled
1>        with
1>        [
1>            U=const PeriodicalReport *
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\serializer.hpp(353) : see 
reference to function template instantiation 'void 
SF::invokePtrSerializer<const T*>(U,SF::Archive &)' being compiled
1>        with
1>        [
1>            T=PeriodicalReport,
1>            U=const PeriodicalReport *
1>        ]
1>        d:\d(work)\iamsvc9\src\rcf\include\sf\stream.hpp(358) : see 
reference to function template instantiation 'SF::Archive &SF::operator 
&<T>(SF::Archive &,const T &)' being compiled
1>        with
1>        [
1>            T=PeriodicalReport
1>        ]
1>        d:\d(work)\iamsvc9\src\server\rcfserializedll\rcfserializedll.cpp
(67) : see reference to function template 
instantiation 'SF::WithSemanticsWrite &SF::WithSemanticsWrite::operator 
<<<Object>(const T &)' being compiled
1>        with
1>        [
1>            Object=PeriodicalReport,
1>            T=PeriodicalReport
1>        ]
1>        d:\d(work)\iamsvc9\src\server\rcfserializedll\rcfserializedll.cpp
(121) : see reference to function template instantiation 'void 
SerializeObject<PeriodicalReport>(Object &,stlp_std::string &,UINT 
&,BOOL)' being compiled
1>        with
1>        [
1>            Object=PeriodicalReport
1>        ]

What is the expected output? What do you see instead?
The compiler doesn't konw which function should call.
in serializer.hpp
there is a function,

   template<typename T>
    inline void serialize(
        Archive &                           archive, 
        T &                                 t)
    {
        typedef typename boost::is_enum<T>::type type;
        serializeEnumOrNot(archive, t, (type *) NULL);
    }

and in my cpp, also have a function
template<typename Archive>
        void serialize(Archive &ar,PeriodicalReport& 
periodicalReport)
    {}



What version of the product are you using? On what operating system?
RCF1.2,vc9(sp1),Windows XP,boost1.42.0,stlport5.2.1

Please provide any additional information below.
I just upgrade RCF1.0 to RCF1.2, my code works fine with RCF1.0.


Original issue reported on code.google.com by [email protected] on 23 Feb 2010 at 8:45

Build errors when building on Linux without RCF_USE_BOOST_ASIO


Compiling on Linux without defining RCF_USE_BOOST_ASIO yields the compiler 
error:

In file included from RCF.cpp:67:
TcpEndpoint.cpp:28:38: error: RCF/TcpServerTransport.hpp: No such file or 
directory

Expected behavior should be to build OK, and be able to run client side 
code (i.e. code that doesn't use RcfServer).

Original issue reported on code.google.com by [email protected] on 12 Aug 2008 at 5:54

Problems with SSL filters

Can you please help me out to resolve this problem on using SSL(OpenSSL) 
transport filter?
I'm tring to send 512KB of data to server, and receive back the same amount of 
data.

Thanks.


Setup of SSL filter on client:
filterPtr.reset( new RCF::OpenSslEncryptionFilter(
        clientCert,
        clientCertPass,
        caCert);

getClientStub().requestTransportFilters(filterPtr);


Setup of SSL service and filter on server:
    filterServicePtr = RCF::FilterServicePtr(new RCF::FilterService());

    server.addService(filterServicePtr);


    filterServicePtr->addFilterFactory(
        RCF::FilterFactoryPtr( new RCF::OpenSslEncryptionFilterFactory(
        serverCert,
        serverCertPass,
        caCert)));


and remote call looks like this:

    BOOL processCmd(std::string &s)
    {
        if(IsTransportSecured(RCF::getCurrentRcfSession()))
        {       
            cout << "ByteBuffer has been received" << endl;
            char *bufToSend = new char[512*1024];
            memset(bufToSend, 0, 512*1024);

            for(int i = 0; i < 512*1024; i++)
            {
                srand(i);
                bufToSend[i] = rand(); 
            }

            s = std::string(bufToSend, 512*1024);
            return TRUE;
        }
        else
        {
            RCF::getCurrentRcfSession().disconnect();
        }

        return FALSE;
    }

First of all I get the assert window with the following info:
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: d:\samples\RFC_PipeTestSSL\Debug\RCF_SERVER.exe
File: c:\program files\microsoft visual studio 9.0\vc\include\vector
Line: 70

Expression: ("_Pvector == NULL || (((_Myvec *)_Pvector)->_Myfirst <= _Ptr && 
_Ptr <= ((_Myvec *)_Pvector)->_Mylast)", 0)

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

and the following server call stack:
>   RCF_SERVER.exe!std::_Vector_const_iterator<RCF::ByteBuffer,std::allocator<RCF:
:ByteBuffer> 
>::_Vector_const_iterator<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> 
>(RCF::ByteBuffer * _Ptr=0x02170d30, const std::_Container_base_secure * 
_Pvector=0x0214c438)  Line 70 + 0x3d bytes  C++
    RCF_SERVER.exe!std::_Vector_iterator<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> >::_Vector_iterator<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> >(RCF::ByteBuffer * _Ptr=0x02170d30, const std::_Container_base_secure * _Pvector=0x0214c438)  Line 322    C++
    RCF_SERVER.exe!std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> >::_Make_iter(std::_Vector_const_iterator<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > _Where={npos=4294967295 mSpvc={...} mSpos={...} ...})  Line 661 + 0x10 bytes C++
    RCF_SERVER.exe!std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> >::erase(std::_Vector_const_iterator<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > _First_arg={npos=4294967295 mSpvc={...} mSpos={...} ...}, std::_Vector_const_iterator<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > _Last_arg={npos=4294967295 mSpvc={...} mSpos={...} ...})  Line 1030 + 0x26 bytes  C++
    RCF_SERVER.exe!std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> >::resize(unsigned int _Newsize=0, RCF::ByteBuffer _Val={...})  Line 721 + 0xd3 bytes    C++
    RCF_SERVER.exe!std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> >::resize(unsigned int _Newsize=0)  Line 713 + 0x53 bytes    C++
    RCF_SERVER.exe!RCF::OpenSslEncryptionFilterImpl::transferData()  Line 523   C++
    RCF_SERVER.exe!RCF::OpenSslEncryptionFilterImpl::retryReadWrite()  Line 463 + 0x8 bytes C++
    RCF_SERVER.exe!RCF::OpenSslEncryptionFilterImpl::onReadWriteCompleted(unsigned int bytesTransferred=2048)  Line 372 C++
    RCF_SERVER.exe!RCF::OpenSslEncryptionFilter::onWriteCompleted(unsigned int bytesTransferred=2048)  Line 243 C++
    RCF_SERVER.exe!RCF::FilterProxy::onWriteCompleted(unsigned int bytesTransferred=2048)  Line 237 + 0x3f bytes    C++
    RCF_SERVER.exe!RCF::IocpSessionState::onReadWriteCompleted(unsigned int bytesTransferred=2048)  Line 461 + 0x61 bytes   C++
    RCF_SERVER.exe!RCF::IocpSessionState::onCompletion(int ret=1, unsigned long dwErr=0, unsigned long completionKey=0, unsigned long dwNumBytes=2048)  Line 977    C++
    RCF_SERVER.exe!RCF::Iocp::cycle(int timeoutMs=1000)  Line 158 + 0x1f bytes  C++
    RCF_SERVER.exe!RCF::ThreadPool::cycle(int timeoutMs=1000, RCF::ShouldStop & shouldStop={...})  Line 485 C++
    RCF_SERVER.exe!RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo> threadInfoPtr={...}, int timeoutMs=1000, const bool & stopFlag=false)  Line 510   C++
    RCF_SERVER.exe!boost::_mfi::mf3<void,RCF::ThreadPool,boost::shared_ptr<RCF::ThreadInfo>,int,bool const volatile &>::operator()(RCF::ThreadPool * p=0x02148158, boost::shared_ptr<RCF::ThreadInfo> a1={...}, int a2=1000, const bool & a3=false)  Line 393 + 0x2c bytes  C++
    RCF_SERVER.exe!boost::_bi::list4<boost::_bi::value<RCF::ThreadPool *>,boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >,boost::_bi::value<int>,boost::reference_wrapper<bool const volatile > >::operator()<boost::_mfi::mf3<void,RCF::ThreadPool,boost::shared_ptr<RCF::ThreadInfo>,int,bool const volatile &>,boost::_bi::list0>(boost::_bi::type<void> __formal={...}, boost::_mfi::mf3<void,RCF::ThreadPool,boost::shared_ptr<RCF::ThreadInfo>,int,bool const volatile &> & f={...}, boost::_bi::list0 & a={...}, boost::_bi::type<void> __formal={...})  Line 458 C++
    RCF_SERVER.exe!boost::_bi::bind_t<void,boost::_mfi::mf3<void,RCF::ThreadPool,boost::shared_ptr<RCF::ThreadInfo>,int,bool const volatile &>,boost::_bi::list4<boost::_bi::value<RCF::ThreadPool *>,boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >,boost::_bi::value<int>,boost::reference_wrapper<bool const volatile > > >::operator()()  Line 21   C++
    RCF_SERVER.exe!boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void,boost::_mfi::mf3<void,RCF::ThreadPool,boost::shared_ptr<RCF::ThreadInfo>,int,bool const volatile &>,boost::_bi::list4<boost::_bi::value<RCF::ThreadPool *>,boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >,boost::_bi::value<int>,boost::reference_wrapper<bool const volatile > > >,void>::invoke(boost::detail::function::function_buffer & function_obj_ptr={...})  Line 154   C++
    RCF_SERVER.exe!boost::function0<void>::operator()()  Line 1013 + 0x16 bytes C++
    RCF_SERVER.exe!thread_proxy(void * param=0x00d5dfbc)  Line 104  C++
    RCF_SERVER.exe!_callthreadstartex()  Line 348 + 0xf bytes   C
    RCF_SERVER.exe!_threadstartex(void * ptd=0x02149228)  Line 331  C
    kernel32.dll!BaseThreadInitThunk()  + 0x12 bytes    
    [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]  
    ntdll.dll!RtlInitializeExceptionChain()  + 0x63 bytes   
    ntdll.dll!RtlInitializeExceptionChain()  + 0x36 bytes   

Original issue reported on code.google.com by [email protected] on 24 Dec 2010 at 3:36

RCF not returning expected values

I am having issues with receiving a value back from a client.  Other
functions work, but this one does not....  I have tried returning a boolean
and a long (long's work on other function calls, just not this particular.
 This example is where I am attempting to try returning a long.

CLIENT SIDE:
long setLocation(std::string in_str)
    {
        bool flag = false;
        std::cout<<"cUFEImpl::setLocation() called in_str =
"<<in_str<<std::endl;

        flag = m_timezone.setlocation(in_str);

        std::cout<<"cUFEImpl::setLocation() status flag = "<<flag<<std::endl;

        if (flag == true)
        {
           std::cout<<"cUFEImpl::setLocation() returnign 9999"<<std::endl;
            return 9999;
        }
        return 0;
    }

SERVERSIDE:
bool sendTimeZone(std::string in_str)
{
#ifdef DEBUGOUT
    loggerimpl<<"cISSUFEImpl::sendTimeZone() called_val";
#endif
   try
   {
       long flag = -1;
       std::cout<<"ISSUFE::sendTimeZone() - Calling MA to set location with
"<<in_str<<std::endl;
       flag = mClient.setLocation(in_str);
       std::cout<<"ISSUFE::sendTimeZone() - MA returned
"<<(long)flag<<std::endl;
       if (flag > 0)
         return true;
       return false;
   }
   catch(...)
   {
#ifdef DEBUGOUT
       loggerimpl<<"cISSUFEImpl::sendTimeZone() Exception occurred.";
#endif
       return false;
   }
}

Attached is the IDL.  Server and Client are separate processes and builds,
but the IDL's are the same.

Here is what I receive when this code is called... 
ISSUFE::sendTimeZone() - Calling MA to set location with US/Michigan
cUFEImpl::setLocation() called in_str = US/Michigan
cTimeZoneObject()::setlocation()called inloc = US/Michigan
cTimeZoneObject()::setlocation() setting location genstring = ln -sf
/usr/share/zoneinfo/posix/US/Michigan /mnt/sdcard/.cxc/localtime
cUFEImpl::setLocation() status flag = 1
cUFEImpl::setLocation() returnign 9999
ISSUFE::sendTimeZone() - MA returned 0

So the Server is actually receiving a 0 and changing the initialized -1
value to 0.

I am compiling with the following parameters:
RCF_USE_BOOST_ASIO
RCF_USE_BOOST_READ_WRITE_MUTEX
RCF_USE_BOOST_THREADS
BOOST_ASIO_HAS_LOCAL_SOCKETS
RCF_USE_ZLIB

Any ideas on what might be happening?  As I said earlier though, other
functions work just fine and return what I would expect (including longs).

Original issue reported on code.google.com by [email protected] on 23 Apr 2009 at 2:06

Attachments:

How can i eliminate the warnings during compilation

What steps will reproduce the problem?
1. compile the rcf server code with g++ 

When we compile the code , we are getting a warning :: converting of 
negative value 0x000000001 to "size_t" . What can we do so that we won't 
get this warning during compilation.

We are using this rcf and we are trying to build a release build. Our 
compilation output is endup in warnings like this. Can you please tell us 
what to do not to get this warning message during compilation. 

if we turn off the warning with -Werror, we are ending up in compilation 
error.

What version of the product are you using? On what operating system?
Version: RCF1.0 
Operating system: Linux


Thanks
-Raveendra

Original issue reported on code.google.com by [email protected] on 30 Jan 2009 at 6:43

cmake on clean RcfDll subproject causes build-error.

What steps will reproduce the problem?
1. Download project tar-file
2. Go into the demo/cmake subfolder.
3. cmake CMakeLists.txt
4. make

What is the expected output? What do you see instead?
There are two error shown in the console:
c++: /wd4275: No such file or directory
c++: /wd4251: No such file or directory

And the build of the shared library libRcfDll.so failed with the message:
make[1]: *** [RcfDll/CMakeFiles/RcfDll.dir/all] Error 2


What version of the product are you using? On what operating system?
RCF 1.2
Ubuntu 9.10

Please provide any additional information below.
When you do another (incremental) build with make, then the shared lib is also 
build. Currently i do not know exactly why that is so.
But attached is a patch for a condition in the RcfDll/CMakeLists.txt to disable 
warnings only if an MSVC compiler is used.


Original issue reported on code.google.com by [email protected] on 13 Oct 2010 at 9:40

Attachments:

Problems with NamedPipe client/sever

Below are the source code of the server and client using NamedPipeEndpoint.

When there is only 1 client everything works just OK. But when I try to start 
second client, either client.connect() or ssPtr->beginSubscribe fails with the 
following exceptions:

On calling client.connect() in the client code:
Failed to connect: [25] Server side object not found. Service: I_TestCMD. 
Interface: I_TestCMD.

and on calling .beginSubscribe()
Server side object not found. Service: I_RequestSubscription. Interface: I_Reque
stSubscription.


There are no problems when using TcpEndpoint

///////////////////////////////
// Server source code
// server.cpp

class testCMD
{
public:

    DWORD connect()
    {
        cout << "server connect has been called" << endl;
        return 0;
    }

    BOOL processCmd(RCF::ByteBuffer s)
    {
        cout << s.getPtr() << endl;
        return TRUE;
    }
    void Notify(const std::string &s)
    {
    }
};


RCF_BEGIN(I_TestCMD, "I_TestCMD")
    RCF_METHOD_R1(BOOL, processCmd, RCF::ByteBuffer)
    RCF_METHOD_R0(DWORD, connect)
    RCF_METHOD_V1(void, Notify, const std::string &)
RCF_END(I_TestCMD)

class RCF_SERVER 
{
public:
    RCF_SERVER(const std::string &pipeName);
    ~RCF_SERVER();

    static void clientConnect(RCF::RcfSession & rcfSession, 
        const std::string & publisherName)
    {
        cout << "Client has been connected." << endl;
    }

    static void clientDisconnect(RCF::RcfSession & rcfSession, 
        const std::string & publisherName)
    {
        cout << "Client has been disconnected" << endl;
    }

    void publish(const std::string &s)
    {
        mPublishingServicePtr->publish( (I_TestCMD *) 0).Notify(s);
    }

private:
    RCF::PublishingServicePtr mPublishingServicePtr;
    RCF::NamedPipeEndpoint *ep;
    RCF::RcfServer *server;
};


RCF_SERVER::RCF_SERVER(const std::string &pipeName)
{
    ep = new RCF::NamedPipeEndpoint(util::toTstring(pipeName));

    server = new RCF::RcfServer(*ep);
    server->getServerTransport().setConnectionLimit(100);
    std::size_t targetThreadCount = 2;
    std::size_t maxThreadCount = 100;
    boost::uint32_t threadIdleTimeoutMs = 30*1000;

    RCF::DynamicThreadPoolPtr dynamicThreadPoolPtr( 
        new RCF::DynamicThreadPool(
        targetThreadCount, 
        maxThreadCount,
        threadIdleTimeoutMs) );

    server->setPrimaryThreadManager(dynamicThreadPoolPtr);


    RCF::PublishingServicePtr psPtr(new RCF::PublishingService());
    server->addService(psPtr);
    mPublishingServicePtr = psPtr;

    testCMD *cmds = new testCMD();
    server->bind<I_TestCMD>(*cmds);
    server->start();


    psPtr->setOnConnectCallback( 
        boost::bind(clientConnect, _1, _2) );

    psPtr->setOnDisconnectCallback( 
        boost::bind(clientDisconnect, _1, _2) );

    psPtr->beginPublish<I_TestCMD>();
}

RCF_SERVER::~RCF_SERVER()
{
    delete server;
}

int _tmain(int argc, _TCHAR* argv[])
{
    RCF::RcfInitDeinit rcfinitDeinit;

    RCF_SERVER server("TestPipe");
    int iCounter = 0;
    while(1)
    {
        if(iCounter % 5 == 0)
        {
            server.publish("Hello there!!!");
            Sleep(1000);
        }
        iCounter++;

        Sleep(1000);
    }

    return 0;
}





///////////////////////////////
// Client source code
// client.cpp

class testCMD
{
public:

    DWORD connect()
    {
        cout << "client connect has been called" << endl;
        return 0;
    }

    BOOL processCmd(RCF::ByteBuffer s)
    {
        cout << s.getPtr() << endl;
        return TRUE;
    }
    void Notify(const std::string &s)
    {
        cout << "Client was notified with: " << s << endl;
    }
};


RCF_BEGIN(I_TestCMD, "I_TestCMD")
    RCF_METHOD_R1(BOOL, processCmd, RCF::ByteBuffer);
    RCF_METHOD_R0(DWORD, connect);
    RCF_METHOD_V1(void, Notify, const std::string &)
RCF_END(I_TestCMD)


int _tmain(int argc, _TCHAR* argv[])
{
    RCF::RcfInitDeinit rcfinitDeinit;

#ifdef BOOST_WINDOWS
    RCF::tstring pipeName = RCF_T("TestPipe");
#else
    RCF::tstring pipeName = RCF_TEMP_DIR "TestPipe";
#endif

    RCF::setDefaultConnectTimeoutMs(3000);
    RCF::NamedPipeEndpoint *ep = new RCF::NamedPipeEndpoint(pipeName);

    RcfClient<I_TestCMD> client(*ep);
    testCMD cmds;

    DWORD res = 0;
tryconnect_again:
    try
    {
        res = client.connect();  // exception may occur here on running more one client
        cout << "Received handle: " << res << endl;
    }
    catch(const RCF::Exception &e)
    {
        Sleep(3000);
        cout << "Failed to connect: [" << e.getErrorId() << "] " << e.getErrorString() << endl;
        goto tryconnect_again;
    }

    RCF::RcfServer subscriber(*ep);
    RCF::SubscriptionServicePtr ssPtr(new RCF::SubscriptionService());
    subscriber.addService(ssPtr);
    subscriber.start();

try_subscribe_again:
    try
    {
        ssPtr->beginSubscribe<I_TestCMD>(cmds, *ep); // exception may occur here on running more than one client
        cout << "Subscribed OK" << endl;
    }
    catch(const RCF::Exception &e)
    {
        Sleep(500);
        cout << e.getErrorString() << endl;
        goto try_subscribe_again;
    }

    while(1)
    {
        Sleep(1000);  
        try
        {      // trying to flood the server
            res = client.connect();
            cout << "connected again" << endl;
        }
        catch(const RCF::Exception &e)
        {
            cout << "Failed to connect: [" << e.getErrorId() << "] " << e.getErrorString() << endl;
            goto tryconnect_again;
        }
    }

    return 0;
}

Original issue reported on code.google.com by [email protected] on 20 Dec 2010 at 3:43

Cannot get to compile.

Compiling with GCC 4.2.4 Linux

IDE = Eclipse Managed C++ Project

Boost Version = 1.36.0
Zlib Version = 1.2.3
OpenSSL Version = 0.9.8i
RCF = 1.0

PreProcessor Defines:
RCF_USE_BOOST_ASIO
RCF_USE_BOOST_THREADS
RCF_MULTI_THREADED
RCF_USE_BOOST_READ_WRITE_MUTEX
RCF_USE_ZLIB
RCF_USE_OPENSSL
RCF_USE_BOOST_SERIALIZATION

Include Paths:
-I/Libraries/IA32/include                       <-- headers for zlib & openSSL
-I/Libraries/IA32/include/boost-1_36            <-- headers for boost
-I/home/iharrold/Libraries/tar/RCF-1.0/include  <-- headers for RCF
-I/home/iharrold/Libraries/tar/RCF-1.0/src/RCF  <-- CPP for RCF
-I/home/iharrold/Libraries/tar/RCF-1.0/src/SF   <-- CPP for SF
-I/home/iharrold/Libraries/tar/RCF-1.0/src      <-- RCF source directory

Library Includes:        <-- All libraries are present and compiled
-lboost_serialization-gcc42-mt
-lboost_system-gcc42-mt
-lboost_thread-gcc42-mt
-lz
-lssl
-L/Libraries/IA32/lib

Project File structure:
RCFProject
 - src
    +-main.cpp  <-- The Echo Server example
    +-RCF.cpp

Attached is the Main.cpp used, the errorlog from the compiler, and the make
file information used to compile it.

I don't know what I am doing wrong.  I don't know if this is the right
location for this question however.

Original issue reported on code.google.com by [email protected] on 23 Jan 2009 at 5:09

Attachments:

Heap Error

I am using the RCF connection for Flash Media Server Backend to pass 
values between two different programs. I get an exception in one of the 
RCF files due to which the program ends. This error is random and usually 
happens when there are many connections simultaneously.

I get the following error in my performance test:

______________________________
The thread 'Win32 Thread' (0x1e6c) has exited with code 0 (0x0).
d:\software\fms 3.0.4 plugins\edge_auth\sample\rcf\tcpclienttransport.cpp
(275): void __thiscall RCF::TcpClientTransport::bsdRecv(const class 
RCF::ByteBuffer &,unsigned int): : Thread-id=2908 : Timestamp(ms)
=14608241: THROW : class RCF::Exception : [30: client read timed out][0: 
No sub system][0: ][What: ][Context: ]: bytesToRead=4, 
First-chance exception at 0x77e4bef7 in FMSCore.exe: Microsoft C++ 
exception: RCF::Exception at memory location 0x07818e98..
'FMSCore.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', No symbols loaded.
First-chance exception at 0x77e4bef7 in FMSCore.exe: Microsoft C++ 
exception: TCBlockedByAdaptor at memory location 0x0781fb90..
The thread 'Win32 Thread' (0x23bc) has exited with code 0 (0x0).
HEAP[FMSCore.exe]: Heap missing last entry in committed range near 08D77C98
Windows has triggered a breakpoint in FMSCore.exe.

This may be due to a corruption of the heap, and indicates a bug in 
FMSCore.exe or any of the DLLs it has loaded.
__________________________________________________________

Original issue reported on code.google.com by [email protected] on 4 Aug 2009 at 2:05

Binding one client thread to a specific server thread

Hi Jarl,

Is there a provision for binding a particular thread in a Multi threaded
client  to a particular  thread in multi threaded server?

suppose,  there is Multi threaded Client with 5 threads in it and Multi
threaded Server with 5 threads. 

Always 1st client thread should communicate ONLY  to 1st server thread.
like wise 

2nd client thread should communicate ONLY  to 2nd Server Thread  etc. and so on

5th client thread should communicate ONLY  to 5th server thread.

Thanks
Regards,
-Raveendra

Original issue reported on code.google.com by [email protected] on 7 May 2009 at 9:40

Cmake aproach - Automated compiled library installer

Hi Jarl

I´m Miguel Penteado from FCA UNESP University in Brazil, Botucatu city, 
São Paulo province.

 I try RFC in my Master Degree Project software, Aton System [do not to 
confuse it with Atom], a Solar Radiometry OpenSource Software. 


So, i had use cmake 2.6 to create an automated library install process for 
windows and make library more popular in Brazil. 

before continue you will need to install

Cmake 2.6 
http://www.cmake.org/HTML/Download.html

and NULLSOFT NSIS
http://nsis.sourceforge.net/Download


(This will should work in Posix too, with some adjust.)

# What is modified

The packet RCF-0.9d-P1 has in it this directory structure:


              |----demo--- .... 
              |
              |               |----RCF-- "Headers"
              |----include----|
              |               |----SF-- "Headers"
              |
              |                 |---RCF--- "Compilable code" ->*RCF.cpp*
RCF-0.9d-P1---|----src----------|
              |                 |---SF---- "Compilable code" ->*SF.cpp*
              |
              |
              |----test---------....
              |

so i add the VC into tree (that contain Visual C++ 2009 project generated 
by cMake).



              |----demo--- .... 
              |
              |               |----RCF-- "Headers"
              |----include----|
              |               |----SF-- "Headers"
              |
              |                 |---RCF--- "Compilable code" ->*RCF.cpp*
RCF-0.9d-P1---|----src----------|
              |                 |---SF---- "Compilable code" ->*SF.cpp*
              |
              |
              |----vc---- "Cmake generated Visual c++ Project "
              |
              |----test---------....
              |

And include cmalists.txt (that will guide Cmake project creation) into 
directory tree like next:


                              |----demo--- .... 
                              |
                              |               |----RCF-- 
                              |----include----|
                              |               |----SF-- 
                              |
                              |                    |-RCF-CmakeLists.txt 
RCF-0.9d-P1--CmakeLists.txt---|-src-CmakeLists.txt-|
                              |                    |-SF--CmakeLists.txt 
                              |
                              |
                              |----vc---- 
                              |
                              |----test---------....
                              |

# What you need to do:
if you want to build package installer only 
  1- You need Visual c++ 8 (2009) installed 
  2- go into ..\RCF-0.9d-P1\vc\
  3- open RCF.sln project
  4- Build subproject install
  5- Build subproject PACKAGE
  6- RCF-0.9d.0-win32.exe will be created
  7- install it

if you want to rebuild c++ visual studio package project 
  1- Open Cmake for windows
  2- point "Where is source code" to 
   (your_unpack_source_dir)\RCF-0.9d-P1\
  3- point "Where to build binaries" to 
   (your_unpack_source_dir)\RCF-0.9d-P1\vc\

  press configure button 2 or 3 times (ignore warnings)
  When OK button is enables, prees it

  4- go into ..\RCF-0.9d-P1\vc\
  5- open RCF.sln project
  6- Build subproject install
  7- Build subproject PACKAGE
  8- RCF-0.9d.0-win32.exe will be created
  9- install it


Then, this will generate a c++ project for a binary package that will 
install this tree into Win32 structure:


                              |----demo--- .... 
                              |
                              |               |----RCF-- "*.hpp"
                              |----include----|
                              |               |----SF-- "*.hpp"
                              |
                              |                    |-RCF--- "*.cpp" 
C:\Program Files\RCF\0.9d\----|-src----------------|
                              |                    |-SF-----"*.cpp" 
                              |
                              |           |--RCF.DLL
                              |----lib----|--RCF.lib
                              |           |--SF.DLL
                              |           |--SF.lib
                              |
                              |----test---------....
                              |

So, user 
# after install package
1- add C:\Program Files\RCF\0.9d\include in %INCLUDE% System variable
2- add C:\Program Files\RCF\0.9d\lib     in %LIB%     System variable

And run samples in 
http://www.codeproject.com/KB/threads/Rcf_Ipc_For_Cpp.aspx?display=Print

The source modified is set attached for you.

Thanks for RCF

Miguel Suarez Xavier Penteado
Aton Solar Radiometry System Developer
miguel_penteado_at_fca.unesp.br

Original issue reported on code.google.com by [email protected] on 28 May 2008 at 3:40

Attachments:

Assert on RCF global initialization

Hello,

Is it possible to instantiate init class RCF::RcfInitDeinit globally?
When I try doing so I get an assert in boost library.

All I want is to create RcfClient instance at the application's earliest 
execution time, even before main() function is called.

Thanks.

Original issue reported on code.google.com by [email protected] on 23 Dec 2010 at 5:58

High CPU load using several multithreaded servers

What steps will reproduce the problem?

1. Compile and run the following code

#include "RCF/Idl.hpp"
#include "RCF/SessionObjectFactoryService.hpp"
#include "RCF/TcpEndpoint.hpp"

RCF_BEGIN(I_Echo, "I_X")
        RCF_METHOD_R1(std::string, echo, const std::string &)
RCF_END(I_Echo)

class Echo
{
        public:
                std::string echo(std::string &a)
                {
                        return a;
                }
};


int main(void)
{
        RCF::RcfServer server( RCF::TcpEndpoint(50001));
        RCF::RcfServer server2( RCF::TcpEndpoint(50002));

        RCF::SessionObjectFactoryServicePtr sofsPtr(
                        new RCF::SessionObjectFactoryService());
        RCF::SessionObjectFactoryServicePtr sofsPtr2(
                        new RCF::SessionObjectFactoryService());

        sofsPtr->bind<I_Echo,Echo>();
        sofsPtr2->bind<I_Echo,Echo>();
        server.addService(sofsPtr);
        server2.addService(sofsPtr2);

        std::size_t threadCount = 2;
        server.setThreadPool( RCF::ThreadPoolPtr( new RCF::ThreadPool(threadCount)));
        server2.setThreadPool( RCF::ThreadPoolPtr( new RCF::ThreadPool(threadCount)));

        server.start();
        server2.start();

        sleep(50);
}

What is the expected output? What do you see instead?

The code launches two multithreaded servers and wait for incoming connections. 
The process keeps the CPU load on 100% without any client connection. Launching 
one single thread on each server works fine. Launching only one server with 
several threads also works fine. 


What version of the product are you using? On what operating system?

I'm using RCF 1.3 on a GNU/Linux system (Ubuntu).


Please provide any additional information below.


Thanks in advance.

Original issue reported on code.google.com by [email protected] on 17 Jun 2011 at 12:19

Can I run the client on WINCE?

I can't compile the client project on the WINCE 5.0/ARM, it reports:
Error 2 fatal error C1083: Cannot open include file: 'io.h': No such file 
or directory h:\business\develop\rcf-
0.9c\include\rcf\util\platform\os\Windows\BsdSockets.hpp 1
Also I find a message:
In addition, third parties have deployed RCF on QNX, WinCE and OS X 
platforms, and on Windows/Linux platforms using the Intel C++ 9 compiler. 
On http://code.google.com/p/rcf-cpp/, So, can anyone give me some advices 
on RCF on WINCE?

Thanks a lot! 

Original issue reported on code.google.com by [email protected] on 14 Jan 2008 at 4:07

CrossCompiling Portability

Suggest modifying the "ByteOrder.hpp" file located /RCF/util/Platform/Machine/

To check for ARM processor.  In my case it was Little Endian.  Thus added:
#elif defined(__arm__)
#include "x86/ByteOrder.hpp"

I inserted this after line 26 and before the "#else   #include
"UnknownMachine/ByteOrder.hpp"

otherwise it compiles and runs on an ARM processor with a linux kernel.

Original issue reported on code.google.com by [email protected] on 23 Jan 2009 at 7:53

Make files needed for unix build

What steps will reproduce the problem?
1. unzip source zip file
2. cd to top of extracted source
3. find ./ -name "[Mm]akefile"

What is the expected output? What do you see instead?
src/RCF/Makefile
src/SF/Makefile

What version of the product are you using? On what operating system?
linux, Fedora Core 8 

Please provide any additional information below.
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)

Original issue reported on code.google.com by [email protected] on 5 Mar 2008 at 12:19

Doesn't build with gcc 4.3

Compiling the demo application with gcc 4.3 yields:

../MyService.hpp:11: error: declaration of ‘typedef struct RcfClient 
MyService::RcfClient’
../MyService.hpp:11: error: changes meaning of ‘RcfClient’ from ‘struct 
RcfClient’


Original issue reported on code.google.com by [email protected] on 12 Aug 2008 at 1:53

Building on MSVC 10.0 fails

What steps will reproduce the problem?
1. Try to compile RCF.cpp with MSVC 10.0

What is the expected output? What do you see instead?
Successful compilation

What version of the product are you using? On what operating system?
rcf-cpp 1.2
Boost 1.42
Visual Studio 2010 32bit with MSVC 10.0 on Windows 7 64-bit.

Please provide any additional information below.
Log attached. There are also some warnings.

Original issue reported on code.google.com by [email protected] on 19 Apr 2010 at 5:30

Attachments:

Compile warnings in Exception.hpp

RCF-1.2/include/RCF/Exception.hpp:400: warning: unused parameter ‘max’
RCF-1.2/include/RCF/Exception.hpp:401: warning: unused parameter ‘ip’

Original issue reported on code.google.com by [email protected] on 8 Dec 2010 at 2:32

CMake for unix/Linux build

Attached a patch where I have moved the cmake files to the root directory and 
added install directives to be able to install it globally under Linux.

This is used in my Debian packaging of the library available at:

https://github.com/mkotsbak/librcf-cpp

Original issue reported on code.google.com by [email protected] on 22 Nov 2012 at 4:42

When the server return a reference variable to client,the server collapsed

What steps will reproduce the problem?
1. Make rcf1.0 to a dll and use it in program.
2. write a function and it has a reference type variable declaration.
3. When a client call that function then return a value to it of reference 
variable,but the server collapsed just this time.

What is the expected output? What do you see instead?
If use rcf lib in program on static library compiler mode, It will work 
very well, but the program link very slowly.

What version of the product are you using? On what operating system?
The rcf version is 1.0, The Operation system is Vista sp1

Please provide any additional information below.
The function callback trace:
0:001> k
ChildEBP RetAddr  
01d0d714 1047487e rcf10dll!_free_dbg_nolock+0x13e 
[f:\sp\vctools\crt_bld\self_x86\crt\src\dbgheap.c @ 1282]
01d0d74c 1046a6f7 rcf10dll!_free_dbg+0x4e [f:\sp\vctools\crt_bld\self_x86
\crt\src\dbgheap.c @ 1220]
01d0d788 1032be5c rcf10dll!operator delete+0xb7 
[f:\sp\vctools\crt_bld\self_x86\crt\src\dbgdel.cpp @ 54]
01d0d86c 10342eac rcf10dll!
std::allocator<std::_Tree_nod<std::_Tmap_traits<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> >,0> 
>::_Node>::deallocate+0x2c [c:\program files\microsoft visual studio 8
\vc\include\xmemory @ 141]
01d0d960 1033b8d4 rcf10dll!std::_Tree<std::_Tmap_traits<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> >,0> 
>::_Erase+0x8c [c:\program files\microsoft visual studio 8
\vc\include\xtree @ 1079]
01d0da44 1032b447 rcf10dll!std::_Tree<std::_Tmap_traits<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> >,0> 
>::clear+0x44 [c:\program files\microsoft visual studio 8\vc\include\xtree 
@ 955]
01d0dba8 1030c20f rcf10dll!std::_Tree<std::_Tmap_traits<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> >,0> 
>::erase+0x167 [c:\program files\microsoft visual studio 8
\vc\include\xtree @ 921]
01d0dcf0 102d8691 rcf10dll!std::_Tree<std::_Tmap_traits<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> >,0> 
>::_Tidy+0x9f [c:\program files\microsoft visual studio 8\vc\include\xtree 
@ 1327]
01d0dde0 102a369b rcf10dll!std::_Tree<std::_Tmap_traits<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> >,0> 
>::~_Tree<std::_Tmap_traits<void *,void *,std::less<void 
*>,std::allocator<std::pair<void * const,void *> >,0> >+0x51 [c:\program 
files\microsoft visual studio 8\vc\include\xtree @ 527]
01d0dec0 1036666e rcf10dll!std::map<void *,void *,std::less<void 
*>,std::allocator<std::pair<void * const,void *> > >::~map<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> > >+0x2b
01d0dfa0 103660de rcf10dll!std::pair<type_info const * const,std::map<void 
*,void *,std::less<void *>,std::allocator<std::pair<void * const,void *> > 
> >::~pair<type_info const * const,std::map<void *,void *,std::less<void 
*>,std::allocator<std::pair<void * const,void *> > > >+0x2e
01d0e080 103657db rcf10dll!std::_Tree_nod<std::_Tmap_traits<type_info 
const *,std::map<void *,void *,std::less<void 
*>,std::allocator<std::pair<void * const,void *> > >,std::less<type_info 
const *>,std::allocator<std::pair<type_info const * const,std::map<void 
*,void *,std::less<void *>,std::allocator<std::pair<void * const,void *> > 
> > >,0> >::_Node::~_Node+0x2e
01d0e160 1035dac8 rcf10dll!std::_Tree_nod<std::_Tmap_traits<type_info 
const *,std::map<void *,void *,std::less<void 
*>,std::allocator<std::pair<void * const,void *> > >,std::less<type_info 
const *>,std::allocator<std::pair<type_info const * const,std::map<void 
*,void *,std::less<void *>,std::allocator<std::pair<void * const,void *> > 
> > >,0> >::_Node::`scalar deleting destructor'+0x2b
01d0e238 102ecf5c rcf10dll!
std::_Destroy<std::_Tree_nod<std::_Tmap_traits<type_info const 
*,std::map<void *,void *,std::less<void *>,std::allocator<std::pair<void * 
const,void *> > >,std::less<type_info const 
*>,std::allocator<std::pair<type_info const * const,std::map<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> > > > 
>,0> >::_Node>+0x28 [c:\program files\microsoft visual studio 8
\vc\include\xmemory @ 61]
01d0e31c 102b75bb rcf10dll!
std::allocator<std::_Tree_nod<std::_Tmap_traits<type_info const 
*,std::map<void *,void *,std::less<void *>,std::allocator<std::pair<void * 
const,void *> > >,std::less<type_info const 
*>,std::allocator<std::pair<type_info const * const,std::map<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> > > > 
>,0> >::_Node>::destroy+0x2c [c:\program files\microsoft visual studio 8
\vc\include\xmemory @ 161]
01d0e40c 1027f884 rcf10dll!std::_Tree<std::_Tmap_traits<type_info const 
*,std::map<void *,void *,std::less<void *>,std::allocator<std::pair<void * 
const,void *> > >,std::less<type_info const 
*>,std::allocator<std::pair<type_info const * const,std::map<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> > > > 
>,0> >::_Erase+0x7b [c:\program files\microsoft visual studio 8
\vc\include\xtree @ 1078]
01d0e4f0 1021af1b rcf10dll!std::_Tree<std::_Tmap_traits<type_info const 
*,std::map<void *,void *,std::less<void *>,std::allocator<std::pair<void * 
const,void *> > >,std::less<type_info const 
*>,std::allocator<std::pair<type_info const * const,std::map<void *,void 
*,std::less<void *>,std::allocator<std::pair<void * const,void *> > > > 
>,0> >::clear+0x44 [c:\program files\microsoft visual studio 8
\vc\include\xtree @ 955]
01d0e5d0 1021bb23 rcf10dll!RCF::PointerContext::clear+0x2b 
[d:\kat\3rdparty\rcf-1.0\include\rcf\serializationprotocol.hpp @ 59]
01d0e6b0 10212e48 rcf10dll!RCF::SerializationProtocolIn::clear+0x33 
[d:\kat\3rdparty\rcf-1.0\src\rcf\serializationprotocol.cpp @ 213]
01d0e9c8 1025d48e rcf10dll!RCF::RcfServer::onWriteCompleted+0x278 
[d:\kat\3rdparty\rcf-1.0\src\rcf\rcfserver.cpp @ 705]

Original issue reported on code.google.com by [email protected] on 22 Jun 2009 at 2:08

Attachments:

OTextStream is giving binary serialization

What steps will reproduce the problem?
1. Compile the attached test program
2. Run it
3. Look at the generated file testfile_SF_text.txt that it is binary

What is the expected output? What do you see instead?
The file should be ASCII text.

What version of the product are you using? On what operating system?
1.1

Please provide any additional information below.

Compiled with:

RCF_COMPILE_LINE="-I $RCF_DIR/include -DRCF_USE_BOOST_ASIO
-DRCF_USE_OPENSSL -DRCF_USE_ZLIB -lboost_thread -lboost_system -lssl -lz
$RCF_DIR/libRCF_SF.o"
g++ -lboost_date_time $RCF_COMPILE_LINE test_text_serialization.cxx

Original issue reported on code.google.com by [email protected] on 29 Jul 2009 at 1:11

Attachments:

Publishing large strings silently fails

What steps will reproduce the problem?
1. Start with a pub/sub example, add a RCF method taking a string
2. Start the publisher & subscriber
2. Publish a huge string, 10000 chars works for me

What is the expected output? What do you see instead?
The method silently fails, does not throw. All other publish methods sent
after also silently fail. Sending a huge string over a normal remote call
doesn't seem to have this problem.


What version of the product are you using? On what operating system?
RCF 1.1, windows XP

Please provide any additional information below.

In case it matters, my test app is pretty much the same as the example in
your article:

    // PUBLISH

    // PropMaps always publish on the specified port. Will listen on all
network interfaces.
    RCF::TcpEndpoint endpoint( "0.0.0.0", port );
    m_svrPtr.reset( new RCF::RcfServer(endpoint) );
    m_pubSvcPtr.reset( new RCF::PublishingService() );

    m_svrPtr->addService(m_pubSvcPtr);
    m_svrPtr->start();

    // Start accepting subscription requests for I_Props.
    m_pubSvcPtr->beginPublish<I_Props>();


    // SUBSCRIBE
    RCF::TcpEndpoint endpoint( -1 );
    RcfServerPtr subSvrPtr( new RCF::RcfServer(endpoint));

    RCF::SubscriptionServicePtr subSvcPtr(
        new RCF::SubscriptionService() );

    subSvrPtr->addService( subSvcPtr );
    subSvrPtr->start();

    subSvcPtr->beginSubscribe<I_Props>( *this,
       RCF::TcpEndpoint(host, port) ); 


Original issue reported on code.google.com by [email protected] on 25 Sep 2009 at 2:22

OS: 10054 - An existing connection was forcibly closed by the remote host

What steps will reproduce the problem?
1. Build the following code from the tutorial 

// Attached the header and source file so you can see defines we use to build 
RCF library
//
#include "../../src/libRCF.h"

#include <iostream>
RCF_BEGIN(I_X, "I_X")
    RCF_METHOD_R2(int, add, int, int)
RCF_END(I_X)
class X
{
public:
    int add(int a, int b) { return a+b; }
};

int main (int, char **)
{
    RCF::init();

    std::string format = "%B %E(%F): (Tid:%D)(Time::%H): %X";
    util::LoggerPtr loggerPtr = util::LoggerPtr(new util::Logger ( RCF::LogNameRcf, 4, util::LogToStdout(), format ));
    loggerPtr->activate();

    //>>> BDM: temp
    X x;
    RCF::RcfServer server( RCF::TcpEndpoint(0));
    server.bind<I_X>(x);
    server.start();

    try
    {
        int port = server.getIpServerTransport().getPort();

        int a = 2;
        int b = 3;
        std::cout 
            << "Client: requesting addition of " 
            << a << " and " << b << std::endl;

        int sum = RcfClient<I_X>( RCF::TcpEndpoint(port)).add(a,b);

        std::cout << "Client: server responded with " << sum << std::endl;
    }
    catch(const std::exception &e)
    {
        std::cout << "Caught exception:\n";
        std::cout << "Type: " << typeid(e).name() << "\n";
        std::cout << "What: " << e.what() << "\n";
    }

    RCF::deinit();
    return 0;
}

2. Build and run/step through it
3. Client throws exception about connection being forcibly closed by server

What is the expected output? What do you see instead?

From the Logs:

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\RcfServer.cpp(121): (Tid:6920)(Time::16): 
RcfServer - adding service. [Args: typeid(*servicePtr).name()=class 
RCF::TcpAsioServerTransport, ]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\RcfServer.cpp(1131): 
(Tid:6920)(Time::16): RcfServer - exposing static binding. [Args: name=I_X, ]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\TcpAsioServerTransport.cpp(344): 
(Tid:6920)(Time::31): TcpAsioServerTransport - listening on port 52672.

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\TcpAsioServerTransport.cpp(143): 
(Tid:6920)(Time::47): TcpAsioSessionState - calling async_accept().

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\RcfServer.cpp(425): 
(Tid:6920)(Time::47):RcfServer - starting service. [Args: 
typeid(*servicePtr).name()=class RCF::TcpAsioServerTransport, ]Client: 
requesting addition of 2 and 3

3 C:\dev\3rdParty\RCF\RCF-1.3\include\RCF/Marshal.hpp(2004): 
(Tid:6920)(Time::63): RcfClient - sending synchronous request. [Args: 
mpClientStub=01D87F38, mpClientStub->mRequest=(r.mToken = ( id = 0 
))(r.mSubInterface = I_X)(r.mFnId = 0)(r.mSerializationProtocol = 
1)(r.mMarshalingProtocol = 1)(r.mOneway = 0)(r.mClose =0)(r.mService = 
I_X)(r.mRuntimeVersion = 8)(r.mPingBackIntervalMs = 0)(r.mArchiveVersion = 0), ]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\Marshal.cpp(155): (Tid:6920)(Time::94): 
RcfClient - connect to server. [Args: this=01D87F38, endpoint=TCP endpoint 
127.0.0.1:52672, mConnectTimeoutMs=2000, ]

4 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(417): 
(Tid:6920)(Time::109): ConnectionOrientedClientTransport - initiating timed 
send operation. [Args: lengthByteBuffers(data)=62, totalTimeoutMs=9985, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\AsioServerTransport.cpp(524): 
(Tid:12048)(Time::109): AsioSessionState - onAccept(). [Args: error.value()=0, ]

4 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(679): 
(Tid:6920)(Time::109): ConnectionOrientedClientTransport - initiating write. 
[Args: lengthByteBuffers(byteBuffers)=62, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\TcpAsioServerTransport.cpp(143): 
(Tid:12048)(Time::125): TcpAsioSessionState - calling async_accept().

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\BsdClientTransport.cpp(304): 
(Tid:6920)(Time::141): BsdClientTransport - initiating send on socket. [Args: 
lengthByteBuffers(byteBuffers)=62, ]

3 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\RcfServer.cpp(687): 
(Tid:12048)(Time::156): RcfServer - completed sending of response. [Args: 
this=01D86508, ]

4 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(670): 
(Tid:6920)(Time::156): ConnectionOrientedClientTransport - initiating read. 
[Args: bytesToRead=4, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\TcpAsioServerTransport.cpp(97): 
(Tid:12048)(Time::172): TcpAsioSessionState - calling async_read_some(). [Args: 
bufferLen=0, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\BsdClientTransport.cpp(182): 
(Tid:6920)(Time::188): BsdClientTransport - initiating read from socket. [Args: 
byteBuffer.getLength()=4, bytesToRead=4, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\AsioServerTransport.cpp(389): 
(Tid:12048)(Time::188): AsioSessionState - read from socket completed. [Args: 
this=01D85E08, bytesTransferred=0, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\AsioServerTransport.cpp(265): 
(Tid:12048)(Time::219): AsioSessionState - destructor. [Args: mState=2, 
mSessionPtr.get()=01D86508, mHasBeenClosed=0, ]

1 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(338): 
(Tid:6920)(Time::219): Exception thrown. [RCF: 31: Client read operation 
failed. OS: 10054 - An existing connection was forcibly closed by the remote 
host.]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ClientStub.cpp(457): 
(Tid:6920)(Time::250): RcfClient - disconnecting from server. [Args: 
this=01D87F38, endpoint=TCP endpoint 127.0.0.1:52672, ]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ClientStub.cpp(457): 
(Tid:6920)(Time::250): RcfClient - disconnecting from server. [Args: 
this=01D87F38, endpoint=TCP endpoint 127.0.0.1:52672, ]

Caught exception:
Type: class RCF::Exception
What: [31: Client read operation failed. OS: 10054 - An existing connection was 
forcibly closed by the remote host.][1: Operating system][10054: An existing 
connection was forcibly closed by the remote host.][What: ][Context: 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(338): 
void __thiscall 
RCF::ConnectionOrientedClientTransport::onTimedRecvCompleted(int,int): : 
Thread-id=6920 : Timestamp(ms)=219: : ]

What version of the product are you using? On what operating system?

RCF 1.3 on 32 bit Windows (both Vista and 2000 Pro), Building and running in 
Visual Studio 2010

Please provide any additional information below.

I tried debugging this with no luck. I built the (almost) exact same code 
against RCF 1.1 and it works perfectly. The only difference was the removal of 
the logging setup since that was added in 1.3.

Original issue reported on code.google.com by [email protected] on 28 Jan 2011 at 11:25

Attachments:

use _WIN32_WINNT failed(Build RCF1.1 with VC6.0)

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
WinXP VC6.0 SP6

Please provide any additional information below.

When Build RCF1.1 with VC6.0, I got following errors 

error C2146: syntax error : missing ',' before identifier 'CERT_CONTEXT'
error C2065: 'CERT_CONTEXT' : undeclared identifier

then I #define _WIN32_WINNT = 0x0500, and get follwing errors,which is the 
typical 102 errors of winsock.How to fix it, Jarl? Thanks very much.

d:\f(program files)\microsoft visual studio\vc98\include\mswsock.h(69) : 
error C2065: 'SOCKET' : undeclared identifier
d:\f(program files)\microsoft visual studio\vc98\include\mswsock.h(69) : 
error C2146: syntax error : missing ')' before identifier 's'
d:\f(program files)\microsoft visual studio\vc98\include\mswsock.h(69) : 
warning C4229: anachronism used : modifiers on data are ignored
d:\f(program files)\microsoft visual studio\vc98\include\mswsock.h(73) : 
error C2059: syntax error : ')'
...................





Original issue reported on code.google.com by [email protected] on 15 Sep 2009 at 8:59

Specify client IP address

I have one RcfServer listening on 10.0.0.1 and two clients on the same machine 
with two IP addresses available: 10.0.0.2 and 10.0.0.3. I want one client bound 
to 10.0.0.2 and the other one to 10.0.0.3.
At this moment, the server identifies both clients coming from the same machine 
(that's OK) and with the same IP address (that's bad).
Is it possible to specify an IP address to be used by a RcfClient object? 
On the server, in order to obtain the client's address, I use:

RCF::getCurrentRcfSession().getRemoteAddress().string();

Of course, on different machines, everything works fine.

Original issue reported on code.google.com by [email protected] on 12 Nov 2010 at 12:55

Do RCF support to establish bidirectional connections?

   An RCF connection normally allows requests to flow in only one 
direction. If an application’s design requires the server to make 
callbacks to a client, the server normally establishes a new connection to 
that client in order to send callback requests or use publish/subscribe 
servers;

  If i establish bidirectional connections, Requests may flow in both 
directions over a bidirectional connection, enabling server to send 
callback requests to a client over the client’s existing connection to 
the server.

   Do the RCF 1.1  support it?

Original issue reported on code.google.com by [email protected] on 4 Apr 2009 at 2:55

Wrong #define-condition "UNICODE" for _T macro.

Steps to reproduce compiler errors because of wrong use of the "_T"-macro:
1. Take the demo project and call the project-property window of the
Client-project.
2. Set "Configuration Properties/General/Character Set/" to "Not Set".
3. Under "Configuration Properties/C/C++/Command Line/Additional Options"
add "\D UNICODE".
4. Rebuild client project.

Then there will be several compiler errors in file sspifilter.hpp, for example:
" cannot convert from 'const char [1]' to 'const RCF::tstring &'", line 186

The macro "_T" is used to convert "" into a char or a wchar_t.
The typedef "tstring" is a std::string or a std::wstring.

With the define "UNICODE", typedef tstring is a std::wstring.
But without define "_UNICODE", _T"" is populated to "", not to L"" and
causes the compiler errors.


Issue occurred in Version 0.9d.

I think, a define UNICODE does not means that the define "_UNICODE" is
automatically there too.
UNICODE is a define for the windows-header (take the ...W variants of the
API Calls).
_UNICODE is a define for the C-Runtime.
See also: http://blogs.msdn.com/oldnewthing/archive/2004/02/12/71851.aspx 

Original issue reported on code.google.com by [email protected] on 5 Aug 2008 at 12:07

problems at reading from a SF::Archive in a remote called function

RCF_BEGIN(I_Test, "I_Test")
RCF_METHOD_V0(void, read )
RCF_END(I_Test)

class Test_Impl
{
public:
  void read()
  {
    Test obj("something stupid");
    std::ifstream in(gArchiveFilename.c_str());
    IArchive archive(in);
    archive>>obj;
  }
};

class Test
{
public:
   Test() : name("kobold") {}

template<class Archive>
   void serialize(Archive & ar, const unsigned int version)
   {
      ar & name;
   }
   std::string name;
};

int main()
{
  Test_Impl tt;
  tt.read();     //->works fine
  ..
  client.read(); //->exception "no bytes in buffer"
}

What steps will reproduce the problem?
1. download attached file (complete example for debugging)
2. compile
3. run :D

What is the expected output? What do you see instead?
exception at remote call

What version of the product are you using? On what operating system?
0.9c/d, WinXP 64, boost1.34.1/1.35.0



Original issue reported on code.google.com by [email protected] on 26 Sep 2008 at 5:56

Attachments:

core-dump

I'm running the demo Server application, but -at runtime- I get the 
following exception:

Server: /home/develop/src/RCF/include/RCF/util/Assert.hpp:27: 
util::VarArgAssert::VarArgAssert(): Assertion `0' failed.

I'm compiling it with:
develop@ROOT_BCK:~/src/testRcf$ g++ -v
Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.6/specs
Configured 
with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr 
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 
--enable-shared --with-system-zlib --enable-nls --without-included-gettext 
--program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu 
--enable-libstdcxx-debug --with-tune=i686 
i486-linux-gnu
Thread model: posix
gcc version 3.4.6 (Debian 3.4.6-5)

I compiled the application with the default RCF_MULTI_THREADED and 
RCF_USE_SF_SERIALIZATION define.

Original issue reported on code.google.com by [email protected] on 1 Apr 2009 at 10:28

Warning about using old headers

What steps will reproduce the problem?
1. Compile with gcc (g++) 4.3.3
2. See the following warning:

In file included from /usr/include/c++/4.3/backward/strstream:51,
                 from ../RCF-1.1/include/RCF/ByteBuffer.hpp:13,
                 from ../RCF-1.1/include/RCF/AsyncFilter.hpp:20,
                 from ../RCF-1.1/include/RCF/ClientStub.hpp:22,
                 from ../RCF-1.1/include/RCF/Idl.hpp:21,
                 from ScriptClient.cxx:5:
/usr/include/c++/4.3/backward/backward_warning.h:33:2: warning: #warning
This file includes at least one deprecated or antiquated header which may
be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a
listing of replacement headers and interfaces, consult the file
backward_warning.h. To disable this warning use -Wno-deprecated.


What is the expected output? What do you see instead?
No warnings

What version of the product are you using? On what operating system?
RCF 1.1

Please provide any additional information below.

The header file (backward_warning.h) gives the following hits to resolving
those warnings:

  Use:                                  Instead of:
  <sstream>, basic_stringbuf            <strstream>, strstreambuf
  <sstream>, basic_istringstream        <strstream>, istrstream
  <sstream>, basic_ostringstream        <strstream>, ostrstream
  <sstream>, basic_stringstream         <strstream>, strstream
  <unordered_set>, unordered_set        <ext/hash_set>, hash_set
  <unordered_set>, unordered_multiset   <ext/hash_set>, hash_multiset
  <unordered_map>, unordered_map        <ext/hash_map>, hash_map
  <unordered_map>, unordered_multimap   <ext/hash_map>, hash_multimap
  <functional>, bind                    <functional>, binder1st
  <functional>, bind                    <functional>, binder2nd
  <functional>, bind                    <functional>, bind1st
  <functional>, bind                    <functional>, bind2nd
  <memory>, unique_ptr                  <memory>, auto_ptr

Original issue reported on code.google.com by [email protected] on 5 Aug 2009 at 11:49

Reg: Support for Asynchronous call

Hi Jarl,

Does the code base 1.0 support the Asynchronous calls?

Will it be possible to use RCF in the solutions where the Proactor/Reactor
appear as viable design options? if so can you please let me know how?

Problem:  There has to be an RCF server. Which has to accept requests from
multiple clients. RCF Server has to reply back synchronously  or
asynchronously depending on the request? 


Thanks
Regards,
-Raveendra


Original issue reported on code.google.com by [email protected] on 20 Apr 2009 at 4:23

Stack Overflow in Windows using ping-back

What steps will reproduce the problem?
1. Establish a connection with ping-backs
2. Make a remote call to a long-running method
3. Wait

What is the expected output? What do you see instead?

Instead of running to completion, runaway recursion causes a stack overflow to 
occur long into waiting.


What version of the product are you using? On what operating system?

RCF 1.3 (I believe 1.2 had some ping-back issues so I'm not using 1.3)
This only occurred for me on Windows (Vista, MSVC 2008); maybe Linux (Ubuntu 
9.04) just allocated a larger stack though.


Please provide any additional information below.

See the attached source which I ran to produce the issue.  It's based off the 
ping-back demo snippets given in the user guide with some slight embellishments 
which reflect my actual application more closely (but shouldn't affect the 
issue).

Original issue reported on code.google.com by [email protected] on 5 Jan 2011 at 4:39

Attachments:

define Interface para with const failed

Hi, Jarl
Recently, I upgrade my code from RCF0.9 to RCF1.1, I find a problem.

I define a interface below:
RCF_METHOD_R2(int,RCF_GetPartInfo,const vector<int>&,CPartInfoArray&);

when I call this method, I get a error:
Thread-id=5252 : Timestamp(ms)=72203: THROW : class RCF::Exception : [57: 
Input data format error.][0: No sub system.][0: ][What: ][Context: ]: 
byte=�, 

I try to debug this problem, I find the const parameter is also serialized 
and sent to client when the server implementation has done(sever return 
result to client).But the client just deserialize the out and return 
Type.That's weird.

Then I change the const vector<int>& to vector<int>& , it works fine.
I try other interfaces with const parameter, they have the same error as 
described before.
PS:
RCF_METHOD_R2(int,RCF_GetPartInfo,const vector<int>&,CPartInfoArray&);
s interface works fine with RCF0.9.

How to fix my probelm? Thanks very much.


What steps will reproduce the problem?



What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
WinXP VC6.0 SP6 boost1.33

Please provide any additional information below.
1)In server side , I used RCF::SessionObjectFactoryServicePtr to create 
server object.
2)And I build with these preprocessor definitions:
WIN32,_DEBUG,_WINDOWS,_MBCS,_USRDLL,RCFSERIALIZEDLL_EXPORTS,_WINSOCKAPI_,RC
F_MULTI_THREADED,RCF_RCF_USE_SF_SERIALIZATION,_DLL,_WIN32_WINNT=0x0500,WIN3
2_LEAN_AND_MEAN


in attachments, the interface is 
RCF_METHOD_R2(int, RCF_GetAlarmCase, const ALARMCASEFILTER&, 
ALARMCASE_VCT&);
you can see in response(see call stack),the ALARMCASEFILTER has been 
serialized.
Erro Info:
Thread-id=3088 : Timestamp(ms)=52203: THROW : class RCF::Exception : [57: 
Input data format error.][0: No sub system.][0: ][What: no end symbol]
[Context: ]:  


Original issue reported on code.google.com by [email protected] on 1 Feb 2010 at 7:31

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.