tags:

views:

65

answers:

3

Hi,

I have to start off by saying I have very little idea on this topic so humor me if i seem ignorant.

Due to the problem of having to use a vc++ library in a g++ compiled program, I built a local server-client system where the server is compiled in vc++ and the client in g++ and they interact through sockets. A lot of data transfer occurs across the socket(close to 2,00,000 records each of 22 fields) and it is a major bottleneck and slows down the entire process a lot. Is there someway I can have a sort of shared memory between the server and client processes so that access would be much faster?

+1  A: 

If they are on same PC then yes, shared memory is faster and it defenetly work across different programs.

If it's on different PCs then also yes, but it's not gonna be faster than sockets.

BarsMonster
its on the same pc. how can I use shared memory? please point me to some resources
Rajesh
BarsMonster
would you reccomend boost::interprocess for my situation?
Rajesh
Defenetly yes .
BarsMonster
+2  A: 

I assume you're using this on a Windows system? (You don't say.) Since it's local client-server, you do have other options.

For windows cross-process communication of large amounts of data, you should look at using memory-mapped files, I think. These can be shared using clobal memory handles. Then with shared kernel objects for synchronisation (mutexes, I would suggest, or events) you can control the access to make sure that it's done in a safe manner.

Provided it's always local, that is probably your fastest and safest method.

(I'd give you more specific API information, but I took my books home yesterday as part of an office clear up - sorry!)

Ragster
"Managing Memory-Mapped Files" http://msdn.microsoft.com/en-us/library/ms810613.aspx
tenfour
A: 

can't you just compile the vc++ code to a dll and call that from your g++ compiled program?

stijn
no..the vc++ is from a vendor and he just gave the header,dll and lib and I'm unable to use that in g++
Rajesh
hmm I thought that was sufficient.. at leat I remember doing it once; eg check this: http://www.mingw.org/wiki/MSVC_and_MinGW_DLLs
stijn
yea..i've tried all that.it doesnt work
Rajesh