|
|
Comments and Discussions
|
|
 |

|
I think RMI for C is great! It is very convenient for C programmers.
|
|
|
|

|
Greeting !!
I use the following to have RCF.o :
g++ -I/home/abc/rcf/RCF-1.3.1/include -I/home/abc/boost/boost_1_49_0 -c -o RCF.o /home/abc/rcf/RCF-1.3.1/src/RCF/RCF.cpp
and then use the following to have echo server :
g++ simpleserver.cpp RCF.o -DRCF_USE_BOOST_ASIO -I/home/abc/rcf/RCF-1.3.1/include
-I/home/abc/boost/boost_1_49_0 -L/usr/lib/boost -lboost_thread -o simpleserver.exe
for echo client :
g++ simpleclient.cpp RCF.o -DRCF_USE_BOOST_ASIO -I/home/abc/rcf/RCF-1.3.1/include -I/home/abc/boost/boost_1_49_0 -L/usr/lib/boost -lboost_thread -o simpleclient.exe
simpleserver.cpp , simpleclient.cpp are sample codes in your "Getting started" listening port "50001" ... compile ok !!
It falied to execute ...error like following :
/home/abc/rcf/RCF-1.3.1/src/RCF/TcpEndpoint.cpp:145: Assertion failed. 0 . Values:
simpleserver.exe: /home/abc/rcf/RCF-1.3.1/include/RCF/util/Assert.hpp:82: virtual util::AssertFunctor::~AssertFunctor(): Assertion `0 && "See line above for assertion details."' failed.
Aborted (core dumped)
I have missed something ...how can I make it run ? Thanks for any suggestion .
|
|
|
|
|

|
Hi Jarl,
I downloaded and put include directory and src/RCF.cpp file directly into my project and
the compilation does not work.
Os: Read Hat 5.2
gcc: 4.1.2
boost: 1.42 (no Asio)
Compilation line:
g++ -c -g -Ircf/include -I/usr/local/include/boost-1_42 -MMD -MP -MF build/Debug/GNU-Linux-x86/rcf/include/RCF/utf8/utf8_codecvt_facet.o.d -o build/Debug/GNU-Linux-x86/rcf/include/RCF/utf8/utf8_codecvt_facet.o rcf/include/RCF/utf8/utf8_codecvt_facet.cpp
Error:
rcf/include/RCF/utf8/detail/utf8_codecvt_facet.cpp:183:21: erreur: opérateur binaire manquant avant l'élément lexical "(" error: binary operator missing before lexical element "("
rcf/include/RCF/utf8/detail/utf8_codecvt_facet.cpp:255:5: erreur: #error WCHAR_MAX not defined!
rcf/include/RCF/utf8/detail/utf8_codecvt_facet.cpp:39: erreur: 'std::codecvt_base' has not been declared
rcf/include/RCF/utf8/detail/utf8_codecvt_facet.cpp:39: erreur: expected constructor, destructor, or type conversion before 'utf8_codecvt_facet'
rcf/include/RCF/utf8/detail/utf8_codecvt_facet.cpp:288: erreur: expected `}' at end of input
rcf/include/RCF/utf8/detail/utf8_codecvt_facet.cpp:288: erreur: expected `}' at end of input
rcf/include/RCF/utf8/detail/utf8_codecvt_facet.cpp:288: erreur: expected `}' at end of input
rcf/include/RCF/utf8/detail/utf8_codecvt_facet.cpp:288: erreur: expected `}' at end of input
Apparently the UTF-8 to UCS-4 does not compile.
Can you help me? (I do not know very well UTF/UCS stuffs...)
Thanks a lot!
Antonio.
|
|
|
|
|

|
Hi Jarl,
This what I have done.
I changed my project and removed everything related to RCF
except "RCF.cpp" and it compiles good now. Apparently the UTF8
conversion is not included/used for basic projects.
Please note this compiler version complains about missing
linefeed (LF) at the end of RCF source files. (last character
must be LF !!)
Regards,
Antonio.
|
|
|
|

|
Does it currently supprot linux (i am using fedora 12 distribution)
|
|
|
|
|

|
Thnaks for replying.
I was actually refering to the RMI article, as I was looking for a framework that will enable me to work with distributed objects. I want to operate from same code remote objects, as local. and I would like to do as less as possible to achive that. The RMI article showed soemthing like that.
But perhaps I missunderstood - is RCF a newer version of RMI?
|
|
|
|
|

|
Hi,
I am trying to implement a light weight RMI to be used in Java<---->Java applications...
At this time I have no idea how to make it (RPC part). I am thinking to implement it using native calls and not relying in Java (implement it in C and export the call to java).
Is this possible? Any tips for the startup of the project?
Thanks you very much!
Alex
|
|
|
|

|
Sure it's possible... But you'll want to use a newer version of RCF than the one this article refers to. Have a look at
http://www.codeproject.com/KB/threads/Rcf_Ipc_For_Cpp.aspx
Regards,
Jarl.
|
|
|
|

|
Hi again,
I forgot to say that the lightweight for of RMI it to be used with also a custom implementation of Jini...
Your other article seems very interesting to replace RMI. Now I have to see if it can be a good base for Jini...
Any comment on this by you would be very appreciated for me.
Thank you very much
Alex
|
|
|
|

|
Hello,
This seem very easy to use, much simpler than RMI.
But i do not manage to put it working under linux.
I have downloaded BOOST (boost_1_37_0.tar.bz2), compile, and test it. It is working.
But regarding RCF I do not know how to use it. According to the google.code site where RCF 1.0 is available, and using the getting started tutorial you should compile RCF.cpp and it is working.
Here it is what I did after boost:
compiling RCF 1.0
g++ -I /home/din-por/Documents/boost_1_37_0 -I /home/din-por/Documents/RCF-1.0/include -DRCF_USE_BOOST_SERIALIZATION RCF.cpp -o RCP
compiling your example that I name server.cpp:
g++ -I /home/din-por/Documents/boost_1_37_0 -I /home/din-por/Documents/RCF-1.0/include -DRCF_USE_BOOST_SERIALIZATION server.cpp -o server
But it does not generate anything. What's wrong??
Regards,
Orlando
|
|
|
|

|
Hi,
This article is quite old, there is a newer one here:
http://www.codeproject.com/KB/threads/Rcf_Ipc_For_Cpp.aspx
As far as getting started, it's easier not to use Boost.Serialization, as if you do, you need to build it separately. So if you remove the -DRCF_USE_BOOST_SERIALIZATION option from your command lines, you should be OK.
I'm not a g++ command line expert, but the two commands above should generate the files RCP and server, but then you need to link them together as well, into an executable. You should be able to do it all in one command, like this:
g++ -I /home/din-por/Documents/boost_1_37_0 -I /home/din-por/Documents/RCF-1.0/include RCF.cpp server.cpp
That should get you an executable, probably named a.out .
Regards,
Jarl.
|
|
|
|

|
I am playing with the sample and I just spawned couple of threads in the existent sample
and the things behave crashy.
void ThrFoo(void* pv)
{
char s[32];
std::vector<std::string xmlns:std="#unknown"> v;
for(int i=0;i<32;i++){
sprintf(s," %d ",i);
v.push_back(s);
}
RcfClient<myservice> c( RCF::TcpEndpoint("localhost", 50001) );
c.reverse(v);
}
int main()
{
for(int i=0;i<60;i++)
_beginthread(ThrFoo,0,0);
Sleep(10000);
return 0;
}
</myservice></std::string>
the client crashes randomly even each thread has it's own RcfClient object.
Crashes happen
here:
Client.exe!boost::detail::sp_counted_base::release() Line 100 + 0x9 bytes C++
here:
Client.exe!std::_Vector_const_iterator<std::pair xmlns:std="#unknown"><boost::shared_ptr xmlns:boost="#unknown"><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer xmlns:rcf="#unknown"> > > >,std::allocator<std::pair><boost::shared_ptr><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer> > > > > >::_Compat(const std::_Vector_const_iterator<std::pair><boost::shared_ptr><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer> > > >,std::allocator<std::pair><boost::shared_ptr><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer> > > > > > & _Right=({px=0x02019108 pn={...} },{px=[1]({mSpvc={...} mSpos={...} mPv=0x02014e98 "// MyService" ...}) pn={...} })) Line 251 + 0x14 bytes C++</rcf::bytebuffer></std::vector></bool></boost::shared_ptr></std::pair></rcf::bytebuffer></std::vector></bool></boost::shared_ptr></std::pair></rcf::bytebuffer></std::vector></bool></boost::shared_ptr></std::pair></rcf::bytebuffer></std::vector></bool></boost::shared_ptr></std::pair>
here:
Client.exe!boost::detail::sp_counted_base::add_ref_copy() Line 73 + 0xb bytes C++
here:
Client.exe!std::vector<std::pair xmlns:std="#unknown"><boost::shared_ptr xmlns:boost="#unknown"><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer xmlns:rcf="#unknown"> > > >,std::allocator<std::pair><boost::shared_ptr><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer> > > > > >::_Insert_n(std::_Vector_const_iterator<std::pair><boost::shared_ptr><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer> > > >,std::allocator<std::pair><boost::shared_ptr><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer> > > > > > _Where=({px=0xfeeefeee pn={...} },{px=[...]() pn={...} }), unsigned int _Count=1, const std::pair<boost::shared_ptr><bool>,boost::shared_ptr<std::vector><rcf::bytebuffer,std::allocator><rcf::bytebuffer> > > > & _Val=({px=0x00000000 pn={...} },{px=[...]() pn={...} })) Line 1163 + 0x14 bytes C++
</rcf::bytebuffer></std::vector></bool></boost::shared_ptr></rcf::bytebuffer></std::vector></bool></boost::shared_ptr></std::pair></rcf::bytebuffer></std::vector></bool></boost::shared_ptr></std::pair></rcf::bytebuffer></std::vector></bool></boost::shared_ptr></std::pair></rcf::bytebuffer></std::vector></bool></boost::shared_ptr></std::pair>
I think wherever the shared variables were altered by the threads;
If the call is protected with a critical section the things are working well, but it shouldn't
as long there are separate client instances / thread.
EnterCriticalSection(&cs);
c.reverse(v);
LeaveCriticalSection(&cs);
It make sense to protect them if the threads are working on the same instance...
void ThrFoo(void* pv)
{
RcfClient<myservice>* pService = reinterpret_cast<rcfclient><myservice>* >pv;
EnterCriticalSection(&cs);
pService->reverse(v);
LeaveCriticalSection(&cs);
}
int main()
{
InitializeCriticalSection(&cs);
RcfClient<myservice> c( RCF::TcpEndpoint("localhost", 50001) );
for(int i=0;i<60;i++)
_beginthread(ThrFoo,0,reinterpret_cast<void>(&c));
Sleep(10000);
DeleteCriticalSection(&cs);
return 0;
}
</void></myservice></myservice></rcfclient></myservice>
Marius C.
|
|
|
|
|

|
what does RCF stand for ?
|
|
|
|

|
Remote Call Framework.... There's an updated article here:
http://www.codeproject.com/KB/threads/Rcf_Ipc_For_Cpp.aspx
|
|
|
|

|
This looks like a great library.
I am wondering if compatible implementations exist in Perl or PHP or Python or any other popular scripting language?
I am looking for something that would give me the interoperability of SOAP, without the performance penalty.
To give you a bit more details - I am looking for a framework to use for an open API project, but I do not want to have to re-implement the API for every single target language. SOAP gives us this flexibility. However in certain cases high volumes of messages need to be exchanged, and in those cases SOAP becomes a major performance bottleneck.
I am sorry if this has already been answered, but I did search the forum as best as I could.
Thanks!
vess
P.S. If I am looking at the wrong tool, and there are better suggestions, please let me know as well.
|
|
|
|

|
Hi,
RCF is implemented in C++ only, so from other languages you would need to write a wrapper for a C++ layer that handles the network communication.
Regards,
Jarl.
|
|
|
|

|
Hi All
I'm novice on this forum, sorry for possible confusions.
My task is to port a 3d render engine from 32-bits to 64. There are a lot of things are (at least) difficult to port (GUI, QuickTime calls, plug-ins, shaders etc). Thus I plan to port "core" to 64 and leave other parts in 32. The only way to do this is to have 2 processes (one 32-bits, another one 64) and organize their interactions. So my questions are:
1) Can I use RCF for OSX (Carbon) platform?
2) Can I use RCF for Windows platform?
3) What is a fastest IPC (no probs if it's low-level/primitive, speed is critical for me)?
Thank you
Igor
|
|
|
|

|
Hi Igor,
First of all, this article refers to an old version of RCF... The new one is here:
http://www.codeproject.com/KB/threads/Rcf_Ipc_For_Cpp.aspx
, and the project homepage is here:
http://code.google.com/p/rcf-cpp/
RCF works well as a 32/64 bit bridge, I've seen it used for that purpose myself. As for your questions,
1) Probably, with some minor tweaking. I don't have access to an OSX platform to test on, but I know users who have made small changes to RCF, and been able to run it on OSX.
2) Yes.
3) In RCF 0.9c you would be best off using TCP. UDP is faster, but doesn't offer any form of connection-oriented interaction, which is often a deal-breaker.
RCF will, probably in the next release, support named pipe transports on Windows, which will be a bit faster than TCP. TCP on a localhost connection is quite fast though, most applications would not have a problem with it.
Regards,
Jarl.
|
|
|
|

|
Hi Jarl,
First,only tell you that I think this is one of the best and more usable code ever written!!
Now, I only have one question,how can I develop an asynchronous call?could you give me an example??
Thanks
Hulka
|
|
|
|

|
Thanks hulka. By the way, there are much newer versions of RCF, have a look here:
http://www.codeproject.com/threads/Rcf_Ipc_For_Cpp.asp
Asynchronous calls are not yet built in to RCF, but I am working on that right now... The next release of RCF will have native asynchronous capability, but until then, if you need a thread to do something while a call is pending, you can either use client progress callbacks, or start your own background threads, and queue up remote calls on that while the main thread does something else.
In RCF 0.9c, have a look in Test_ClientProgress.cpp to see how client progress callbacks are used.
Cheers,
jarl.
|
|
|
|

|
Hello Jarl,
I’m trying to use your RCF. Start of all, I started the next interface.
RCF_METHOD_V1(void, func1, std::vector)
This test works well.
OS : Redhat Linux WS4
Machine : IBM Thinkpad X41
Development Environment: Eclipse 3.2 with CDT
using NO_BOOST_SERIALIZATION option.
In the next case, I started to build next 2 interface.
(1) 1’st case -- Static Array Version
typedef int intarray[100];
:
RCF_METHOD_V1(void, func1, intarray)
In this case , I can compile source code, but in runtime, I encountered the next runtime error in client side.
[Error Message]
Caught exception;
Type: N3RCF18RecvCloseExceptionE
What: ../../RCF/include/RCF/Marshal.inl(77); RCF::IDL::InReturnValue ::InReturnValue(RCF::Connection&,ool): :Thread-id=0 : Timestamp(ms)=51465:THROW:RCF:RecvCloseException: connection closed by server
(2) 2’nd case -- Dinamic Array Version
typedef SF::DynamicArray IntArray;
:
RCF_METHOD_V1(void, func1, IntArray)
In this case, compiler generates error! In Compile process, code “RCF_METHOED_V1(void, func1, IntArray)” is perhaps converted to a code to instantiate “SF::DynamicArray” with no argument. but in SF/SerializeDynamicArray.hpp, no default creator is defined. So error is generated(I guess from complier error message).
Please tell me how can I use Array in RCF argument.
Best regards
ykishii
|
|
|
|

|
First of all, you need to use a newer version of RCF:
http://www.codeproject.com/threads/Rcf_Ipc_For_Cpp.asp
To send an array of integers, you should use std::vector as the type of the parameter. Static arrays like int[] are not supported as interface parameters. SF::DynamicArray is an internal implementation class, and is not intended for use as an RCF interface parameter, either.
Regards,
Jarl.
|
|
|
|

|
Thank you, Mr. Jarl,
RCF_METHOD_V1(void, func1, std::vector<int>)
This test works well. The next data present the elapsed time for remote call, this shows that remote call requires the time linear to the data length.
Size of vector elapsed time(average of 1000 calls)
10 0.00164335[s/call]
100 0.00270757[s/call]
1000 0.0109117[s/call]
10000 0.0927689[s/call]
100000 0.931833[s/call]
I want to speed up remote method call, and I think that Array may be sent more quickly.
Former question is to confirm this hypothesis, but not supported by RCF.
Is there any advice to shorten the time required to the remote call(with large vector data)?
Regards,
ykishii.
|
|
|
|

|
Hi ykishii,
Sorry for the late response... If you get the latest version of RCF, RCF 0.9c, available here , you can use the RCF::ByteBuffer class as a parameter in your interfaces, and that should be a lot faster than using std::vector with older versions of RCF.
Regards,
jarl.
|
|
|
|

|
I would need to solve this problem:
If some remote function does not respond to the client RCF::RecvTimeoutException is thrown.
But how to kill a remote function on the server which caused this exception.
Could you help me ?
Thanks,
Petr
http://www.codeproject.com/script/profile/confirm.asp?i=3129526&h=3B74C57CC521D8900F45
|
|
|
|

|
Hi,
It sounds like you want to explicitly kill a server thread, which is not really a good idea. In general there's only 1 thread in the server, answering client requests one at a time, so if you kill it, the server will no longer respond to any client requests.
If you're bent on doing it, though, the operating system API has functions for killing threads, any of those would do.
BTW, there is a new and improved version of this framework, here.[^]
Regards,
Jarl.
|
|
|
|

|
Hi Jarl,
I was looking for a lightweight RPC library for C++ and found your page. This looks like a very nice interface and attracted me immediately.
However, it seems to rely on boost 1.33.0. I have two questions:
1. Are you planning to make it independent of boost? How much effort would that be? (I could probably help a bit if it's not too much of work)
2. Or are you planning to make it compatible with boost 1.33.1 (or whatever the latest version is)? I tried to build it with 1.33.1 and it complains about missing files (test/minimal.hpp, read_write_mutext.hpp, etc)
Thanks.
Hua
|
|
|
|

|
Hi Hua,
Sorry, I didn't realize there were any problems compiling with boost 1.33.1, I'll put together an update and post it here. The code is meant to work with any of the newer versions of boost.
As for making RCF independent of Boost, that has so far not been a high priority for me I've used Boost pretty extensively thoughout RCF, and eliminating it would be a lot of work, with questionable results, IMHO.
Finally, I should point out that I'm no longer actively maintaining this version of RCF; there is a newer version available here:
http://www.codeproject.com/threads/Rcf_Ipc_For_Cpp.asp[^]
It has all the features of this version, with a lot of extra things as well (encryption, compression, publish/susbcribe, interface inheritance, etc.)
Regards,
Jarl.
|
|
|
|

|
Jarl,
I just wanted to put in a good word for your project. I am using the C++ RMI framework for a project and found the overall setup very nice. We are using the framework to glue a Matlab application to binary data base. Writing/modification of the Matlab client ".mex" was the most challenging part. We did have to up the maximum message size from the original 1024*50 to support our needs.
Cheers,
Matt
|
|
|
|

|
Good to hear, thanks for the info!
/Jarl.
|
|
|
|

|
Hi,
I read your article. Good work. Haven't looked thru the source yet.
Could this code be used to "new up" proxy objects on the client side that mapped to concrete objects on the server. Example - a video server, where there is a server class CTwoDObject with a bunch of methods. I want to be able to create proxy object representations on the client side and have the server create concrete objects, then be able to invoke methods on these objects and have your code handle the messaging between the client-server.
Right now, I have this working currently by having each method Send a command to pass a message to the server (each object is identified with a unique handle). It is rather cumbersome as each method has a SendCommand and/or ReceiveReply. Also, the server has to have something similar.
Could you give an example of your code doing something similar?
thanks for any info.
Jim
|
|
|
|

|
Hi Jim,
Have you looked at the updated version of RCF here[^]?
Have a look at the ObjectFactoryService class, it lets clients create objects on the server and then call methods on them. There's a short example in the article, if you have any questions about it just ask.
Regards,
Jarl.
|
|
|
|

|
First I must point out that it's a good-looking library, definitely the cleanest interface for remote invokation around.=)
However, I have some questions which I could't find any answer to when I first looked at your library, but that was quite a while ago and maybe things have changed since.
As a user I want to be able to use a transport layer of my choice, and not be bound to the default tcp implementation. Can this be done?
Can I bind application specific data to a client connection on the server side?
Can I make asynchrounous calls from the client?
Can I feed the server and client with raw input and it'll decode and invoke the content?
Regards,
Christian
|
|
|
|

|
Hi Christian,
I've made quite a few changes to RCF over the last 6 months, but they're on a different branch than this version, you can find the new version here[^]. I'll answer your questions based on that version:
chrhol wrote: As a user I want to be able to use a transport layer of my choice, and not be bound to the default tcp implementation. Can this be done?
The transport layer is now separated from the rest of RCF (it wasn't before), so you can write your own; I've written server and client transports for TCP and UDP, you can check them out to see how it works.
chrhol wrote: Can I bind application specific data to a client connection on the server side?
Not right now, but it should be easy for me to add, I'll add it to the list of things to implement for the next release. What you can do at the moment is to let clients create objects on the server, using ObjectFactoryService, and have the client-specific data in those objects. They're not tied to the physical connection though.
chrhol wrote: Can I make asynchrounous calls from the client?
Besides the usual two-way request/response way of making a call, you can also make one-way calls; the client sends a message to the server, but then doesn't hang around for a reply, and in fact the server never sends one either. Proper asynchronous calls are currently not implemented, ie where you're informed at a later point in time that a call has completed.
chrhol wrote: Can I feed the server and client with raw input and it'll decode and invoke the content?
Not implemented, but that probably wouldn't be hard to setup. In what scenario would you be using it?
Regards,
Jarl.
|
|
|
|

|
Hi Jarl,
Thanks for the replies, much appreciated! From now on I will follow your development on the library where it's updated, so I do not need to ask questions that I can find out for myself
Jarl Lindrud wrote: chrhol wrote:
Can I feed the server and client with raw input and it'll decode and invoke the content?
Not implemented, but that probably wouldn't be hard to setup. In what scenario would you be using it?
For tunnelling your RCF protocol over an already established connection where I want to mix protocols from different systems. If I oversimplify, I would like to do something like this:
enum protocol
{
system_0,
system_1,
..
rcf_1
}
struct net_packet
{
protocol proto;
std::pair data;
security_descriptor &security;
}
void server_invoke(net_packet &p)
{
if(p.proto == rcf_1)
{
rcf_server.invoke(p.data.first, p.data.second, p.security.get_rcf_client_connection());
}
else
{
...
}
}
It's a bit rough, I agree, but hopefully I showed my point anyway
Regards,
Christian
|
|
|
|

|
chrhol wrote: For tunnelling your RCF protocol over an already established connection where I want to mix protocols from different systems. If I oversimplify, I would like to do something like this:
OK I see, that would be useful. I'll put it on the list of things to do. Might be a little while before I get around to dealing with it though, I'm a bit occupied at the moment getting RCF to run on Unix, but after that
Jarl.
|
|
|
|

|
I tried to make demo in solaris for many times,but failed.Can you tell how to make demo in solaris ,please give me your Makefile,Thanks.
|
|
|
|

|
It's been a while since I built RCF on solaris, but I used bjam, from Boost, to build it, instead of a makefile. I can use the same jamfile to build things on Windows/Linux/Solaris, with just about any compiler, and I find it a lot simpler than using makefiles.
It shouldn't make any difference, though, which build tool you're using. Which version of which compiler are you using? What errors are you getting? Compiler errors or linker errors?
Regards,
Jarl.
|
|
|
|

|
first ,thanks for reply in time.
my step as follws
1. using qmake create Makefile
#############################################################################
# Makefile for building: Client
# Generated by qmake (1.07a) (Qt 3.3.4) on: Tue Jan 17 20:59:31 2006
# Project: Client.pro
# Template: app
# Command: $(QMAKE) -o Makefile Client.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
CFLAGS = -pipe -Wall -W -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT
CXXFLAGS = -pipe -Wall -W -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -DRCF_NO_BOOST_SERIALIZATION
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I/usr/lib/qt-3.3/mkspecs/default -I. -I. -I$(QTDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE= $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
HEADERS =
SOURCES = Client.cpp \
..\MyService.hpp \
..\RCF\RCF.cpp \
..\SF\SF.cpp
OBJECTS = Client.o \
MyService.o \
RCF.o \
SF.o
FORMS =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST = Client.pro
QMAKE_TARGET = Client
DESTDIR =
TARGET = Client
first: all
####### Implicit rules
.SUFFIXES: .c .o .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
mocables: $(SRCMOC)
uicables: $(UICDECLS) $(UICIMPLS)
$(MOC):
( cd $(QTDIR)/src/moc && $(MAKE) )
Makefile: Client.pro /usr/lib/qt-3.3/mkspecs/default/qmake.conf /usr/lib/qt-3.3/lib/libqt-mt.prl
$(QMAKE) -o Makefile Client.pro
qmake:
@$(QMAKE) -o Makefile Client.pro
dist:
@mkdir -p .tmp/Client && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/Client/ && ( cd `dirname .tmp/Client` && $(TAR) Client.tar Client && $(GZIP) Client.tar ) && $(MOVE) `dirname .tmp/Client`/Client.tar.gz . && $(DEL_FILE) -r .tmp/Client
mocclean:
uiclean:
yaccclean:
lexclean:
clean:
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET) $(TARGET)
FORCE:
####### Compile
Client.o: Client.cpp ../MyService.hpp
MyService.o: ..\MyService.hpp
$(CC) -c $(CFLAGS) $(INCPATH) -o MyService.o ..\MyService.hpp
RCF.o: ..\RCF\RCF.cpp ../RCF/ClientStub.cpp \
../RCF/Connection.cpp \
../RCF/Exception.cpp \
../RCF/InitDeinit.cpp \
../RCF/MethodInvocation.cpp \
../RCF/Multiplexer.cpp \
../RCF/Protocol/Protocol.cpp \
../RCF/Random.cpp \
../RCF/RcfServer.cpp \
../RCF/Token.cpp \
../RCF/Tools.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o RCF.o ..\RCF\RCF.cpp
SF.o: ..\SF\SF.cpp ../SF/Archive.cpp \
../SF/DataPtr.cpp \
../SF/deque.cpp \
../SF/Encoding.cpp \
../SF/Exception.cpp \
../SF/I_Stream.cpp \
../SF/ITextStream.cpp \
../SF/IBinaryStream.cpp \
../SF/INativeBinaryStream.cpp \
../SF/list.cpp \
../SF/map.cpp \
../SF/memory.cpp \
../SF/Node.cpp \
../SF/OBinaryStream.cpp \
../SF/ONativeBinaryStream.cpp \
../SF/OTextStream.cpp \
../SF/PortableTypes.cpp \
../SF/Registry.cpp \
../SF/scoped_ptr.cpp \
../SF/SerializeSmartPtr.cpp \
../SF/SerializeStl.cpp \
../SF/SerializeStaticArray.cpp \
../SF/SerializeDynamicArray.cpp \
../SF/SerializeFundamental.cpp \
../SF/SerializePolymorphic.cpp \
../SF/Serializer.cpp \
../SF/set.cpp \
../SF/SfNew.cpp \
../SF/shared_ptr.cpp \
../SF/Stream.cpp \
../SF/string.cpp \
../SF/Tools.cpp \
../SF/vector.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o SF.o ..\SF\SF.cpp
####### Install
install:
uninstall:
2. execute make and got such errors
make
make: *** No rule to make target `..\MyService.hpp', needed by `MyService.o'. Stop.
3. gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)
can you tell me how to use bjam to build demo and show me you jamfile,thanks.
|
|
|
|

|
First of all it's enough to just compile RCF.cpp and SF.cpp, they will pull in the rest of the source files themselves. So the rules for SF.o and RCF.o only need to compile SF.cpp and RCF.cpp, respectively.
The error that you're getting is because you're trying to compile MyService.hpp. You need to remove the MyService.o target, it will be included as a .hpp file into the server and client anyway.
Other than that, you should be fine. The jamfile that I use to build RCF test executables is in the /test directory, called "Jamfile". It has lots of targets, but you only need to build one at a time. I can type "bjam -sTOOLS=gcc -sBUILD=debug" Test_Minimal" to build a debug executable with the gcc compiler, for instance.
You'd need to build bjam first. It's part of boost, and there are instructions there on how to do it. Probably you only need to go to the ...boost\tools\build\jam_src and run the build.sh script.
Hope that helps,
Jarl.
|
|
|
|

|
thank you very much.
According to your guilding , I compiled demo in unix successfully.
|
|
|
|

|
That's great. If you want, you can also compile and run the server on one operating system, and the client on another, and remote calls between the two will still work fine.
Jarl.
|
|
|
|

|
great! It do work properly!
I have another question. RMI can call a function from client to server,if I want to call a function from server to client, How can I do?
|
|
|
|

|
The short story is, a server can't call a client... otherwise the client would have to be a server too.
So basically, you need to have two servers, one on each end.
By the way, I have a newer version of this framework available here[^]. It has a publish/subscribe feature that might be what you're looking for.
The new version only supports Windows so far, but that will change pretty soon. The next release should be out in a couple of weeks, and will run on both Windows and Unix OS's.
/Jarl.
|
|
|
|

|
Hello!
I ve used SF not the boost lib to serialize. No have found that the executable moans about the size of the objects to be returned. It says:
..\rcf\src\rcf\connection.cpp(376): int __thiscall RCF::Connection::receive(void)::Thread-id=2436:
Timestamp(ms)=52327: THROW : RecvException: too much data: fd=1944, length=15592,
How can I overcome this error?
Many thanks in advance
Reinhard Stoeckl
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
User-friendly remote method invocation in C++.
| Type | Article |
| Licence | CPOL |
| First Posted | 7 Feb 2005 |
| Views | 440,005 |
| Downloads | 3,421 |
| Bookmarked | 144 times |
|
|