By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

Sending Data over Shared Memories (MFC)

P: n/a
Hi,

I want to develop a program, that transmits several classes between two
processes. It should be built after the guidelines of the
iso/osi-reference model and work with a shared memory. At the moment I
copy all the data into a buffer, add the specific overhead and send
them to the memory. But if the data contains any strings, it adds only
the pointer and not the string itsself. How can I realize, that the
program copies the string and not the pointer into "pBuffer"? I have
already looked at serialization and streams, but it still didn't work.

Anyone knows, how to handle this problem?
The structure for the data transport looks like this:

struct SDataModule // layer 7 module
{
long commandCount; // number of elements in the buffer
char pBuffer[MAX_COUNT_BYTES]; // storage buffer
};

struct STransportModule // layer 4 module
{
long seqNumber; // a sequence number to mark each block
SDataModule data; // the data to transport
};

struct SNetworkModule // layer 3 module
{
char source[16]; // the ip from the user computer
STransportModule transport; // the data to transport
};

struct SMemoryModule // layer 1 module
{
BOOL full; // indication that the shared memory is full
SNetworkModule network; // the data to transport
};
TIA
Volker Nitschke

Jul 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<vo*************@gmx.dewrote:
(MFC question)
That's strictly Microsoft stuff. Has nothing to do with C++.

Ask HERE instead:

comp.os.ms-windows.programmer.win32 (I set followup here.)

--
Cheers,
Robbie Hatley
East Tustin, CA, USA
lone wolf intj at pac bell dot net
(put "[usenet]" in subject to bypass spam filter)
http://home.pacbell.net/earnur/
Jul 11 '06 #2

P: n/a
<vo*************@gmx.dewrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi,

I want to develop a program, that transmits several classes between two
processes. It should be built after the guidelines of the
iso/osi-reference model and work with a shared memory. At the moment I
copy all the data into a buffer, add the specific overhead and send
them to the memory. But if the data contains any strings, it adds only
the pointer and not the string itsself. How can I realize, that the
program copies the string and not the pointer into "pBuffer"? I have
already looked at serialization and streams, but it still didn't work.

Anyone knows, how to handle this problem?
The structure for the data transport looks like this:

struct SDataModule // layer 7 module
{
long commandCount; // number of elements in the buffer
char pBuffer[MAX_COUNT_BYTES]; // storage buffer
};

struct STransportModule // layer 4 module
{
long seqNumber; // a sequence number to mark each block
SDataModule data; // the data to transport
};

struct SNetworkModule // layer 3 module
{
char source[16]; // the ip from the user computer
STransportModule transport; // the data to transport
};

struct SMemoryModule // layer 1 module
{
BOOL full; // indication that the shared memory is full
SNetworkModule network; // the data to transport
};
Those structures are interesting, but not much help without telling us what
you are trying to do with them. Nor are you showing us the structures.

Quote: "But if the data contains any strings, it adds only the pointer and
not the string itsself."

What is this "it" you are refering to? A function? A method? An
assignment?

Your answer may be as simple as how to use strncpy or memcpy or an iterator.
Or not. Show us what you are trying to do that is not working.
Jul 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.