Sending entire objects via socket vs primitive message fields

I am using a library called "The Network Development Kit".
http://www.codeproject.com/internet/ndk.asp

The kit allows me to easily establish client/server connections and assemble
"messages" (consisting of strings, integers, etc) to pass back and forth
between the client and server.

With my initial protocol design, I have been passing data via the primitive
data field types (strings, int's, etc). The basic logic flow requires me to:
1) Deconstruct the object and assemble the varying field values into a
CNDKMessage.
2) Send that message to the server and reconstruct the object on the server
side.
3) Do some processing.
4) Deconstruct the object again assembling its different values into a
CNDMessage and send it back to the client.
5) The client then takes the message fields and recontructs the object with
the new values.

Within the message assembly class, there exists an interface that allows me
to send an entire object (LPVOID,UINT size).

This would make it much more convenient to just send the entire object
between the client/server without having to compose/decompose it's primitive
elements.

I don't see any troubles with this. But am I missing some design
considerations here? The only one that I can think of is that this may cause
troubles when producing a cross-platform client.  Serializing a "CObject" on
the windows side may not translate correctly within a Linux client.

How does everyone else generally do it? Do you usually just send the entire
object, or do you decompose your protocol into primitive types of integers
and strings?

Thanks in advance.


0
chase_jo (3)
7/20/2003 8:37:31 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
1210 Views

Similar Articles

[PageSpeed] 50

Joseph Chase wrote:
> 
> I am using a library called "The Network Development Kit".
> http://www.codeproject.com/internet/ndk.asp
> 
> The kit allows me to easily establish client/server connections and assemble
> "messages" (consisting of strings, integers, etc) to pass back and forth
> between the client and server.
> 
> With my initial protocol design, I have been passing data via the primitive
> data field types (strings, int's, etc). The basic logic flow requires me to:
> 1) Deconstruct the object and assemble the varying field values into a
> CNDKMessage.
> 2) Send that message to the server and reconstruct the object on the server
> side.
> 3) Do some processing.
> 4) Deconstruct the object again assembling its different values into a
> CNDMessage and send it back to the client.
> 5) The client then takes the message fields and recontructs the object with
> the new values.
> 
> Within the message assembly class, there exists an interface that allows me
> to send an entire object (LPVOID,UINT size).
> 
> This would make it much more convenient to just send the entire object
> between the client/server without having to compose/decompose it's primitive
> elements.
> 
> I don't see any troubles with this. But am I missing some design
> considerations here? The only one that I can think of is that this may cause
> troubles when producing a cross-platform client.  Serializing a "CObject" on
> the windows side may not translate correctly within a Linux client.
> 
> How does everyone else generally do it? Do you usually just send the entire
> object, or do you decompose your protocol into primitive types of integers
> and strings?
> 
> Thanks in advance.

Sending an entire object with (LPVOID, UINT size) is not usually
practical.  If the object contains any pointers then all this simple
approach does is send the pointers, not the "contained" data.  All
dynamically resizable container classes (vector, CString, ...) contain
pointers.

MFC contains a reasonably rich set of container classes that already
support serialization.  I.e. the MFC code will help compose/decompose
objects.

--
Scott McPhillips [VC++ MVP]
0
scottmcp (342)
7/21/2003 12:48:52 AM
Is it anything that derives from CObject, supports serialization?

Within my class, I have usage of CString, CMap<>, and CStringArray.  Are
these going to be supported?

Do the classes utilized within the CMap template have to support
serialization?

"Scott McPhillips" <scottmcp@mvps.org> wrote in message
news:3F1B3874.239C899B@mvps.org...
> Joseph Chase wrote:
> >
> > I am using a library called "The Network Development Kit".
> > http://www.codeproject.com/internet/ndk.asp
> >
> > The kit allows me to easily establish client/server connections and
assemble
> > "messages" (consisting of strings, integers, etc) to pass back and forth
> > between the client and server.
> >
> > With my initial protocol design, I have been passing data via the
primitive
> > data field types (strings, int's, etc). The basic logic flow requires me
to:
> > 1) Deconstruct the object and assemble the varying field values into a
> > CNDKMessage.
> > 2) Send that message to the server and reconstruct the object on the
server
> > side.
> > 3) Do some processing.
> > 4) Deconstruct the object again assembling its different values into a
> > CNDMessage and send it back to the client.
> > 5) The client then takes the message fields and recontructs the object
with
> > the new values.
> >
> > Within the message assembly class, there exists an interface that allows
me
> > to send an entire object (LPVOID,UINT size).
> >
> > This would make it much more convenient to just send the entire object
> > between the client/server without having to compose/decompose it's
primitive
> > elements.
> >
> > I don't see any troubles with this. But am I missing some design
> > considerations here? The only one that I can think of is that this may
cause
> > troubles when producing a cross-platform client.  Serializing a
"CObject" on
> > the windows side may not translate correctly within a Linux client.
> >
> > How does everyone else generally do it? Do you usually just send the
entire
> > object, or do you decompose your protocol into primitive types of
integers
> > and strings?
> >
> > Thanks in advance.
>
> Sending an entire object with (LPVOID, UINT size) is not usually
> practical.  If the object contains any pointers then all this simple
> approach does is send the pointers, not the "contained" data.  All
> dynamically resizable container classes (vector, CString, ...) contain
> pointers.
>
> MFC contains a reasonably rich set of container classes that already
> support serialization.  I.e. the MFC code will help compose/decompose
> objects.
>
> --
> Scott McPhillips [VC++ MVP]


0
chase_jo (3)
7/21/2003 2:29:03 PM
Archive your data to a CMemFile.
You are then able to read the memfile into buffers, send them, and 
recreate the memfile at the other end. You can then construct another 
CArchive from the memfile and read in the objects.

Joseph Chase wrote:

> Is it anything that derives from CObject, supports serialization?
> 
> Within my class, I have usage of CString, CMap<>, and CStringArray.  Are
> these going to be supported?
> 
> Do the classes utilized within the CMap template have to support
> serialization?
> 
> "Scott McPhillips" <scottmcp@mvps.org> wrote in message
> news:3F1B3874.239C899B@mvps.org...
> 
>>Joseph Chase wrote:
>>
>>>I am using a library called "The Network Development Kit".
>>>http://www.codeproject.com/internet/ndk.asp
>>>
>>>The kit allows me to easily establish client/server connections and
> 
> assemble
> 
>>>"messages" (consisting of strings, integers, etc) to pass back and forth
>>>between the client and server.
>>>
>>>With my initial protocol design, I have been passing data via the
> 
> primitive
> 
>>>data field types (strings, int's, etc). The basic logic flow requires me
> 
> to:
> 
>>>1) Deconstruct the object and assemble the varying field values into a
>>>CNDKMessage.
>>>2) Send that message to the server and reconstruct the object on the
> 
> server
> 
>>>side.
>>>3) Do some processing.
>>>4) Deconstruct the object again assembling its different values into a
>>>CNDMessage and send it back to the client.
>>>5) The client then takes the message fields and recontructs the object
> 
> with
> 
>>>the new values.
>>>
>>>Within the message assembly class, there exists an interface that allows
> 
> me
> 
>>>to send an entire object (LPVOID,UINT size).
>>>
>>>This would make it much more convenient to just send the entire object
>>>between the client/server without having to compose/decompose it's
> 
> primitive
> 
>>>elements.
>>>
>>>I don't see any troubles with this. But am I missing some design
>>>considerations here? The only one that I can think of is that this may
> 
> cause
> 
>>>troubles when producing a cross-platform client.  Serializing a
> 
> "CObject" on
> 
>>>the windows side may not translate correctly within a Linux client.
>>>
>>>How does everyone else generally do it? Do you usually just send the
> 
> entire
> 
>>>object, or do you decompose your protocol into primitive types of
> 
> integers
> 
>>>and strings?
>>>
>>>Thanks in advance.
>>
>>Sending an entire object with (LPVOID, UINT size) is not usually
>>practical.  If the object contains any pointers then all this simple
>>approach does is send the pointers, not the "contained" data.  All
>>dynamically resizable container classes (vector, CString, ...) contain
>>pointers.
>>
>>MFC contains a reasonably rich set of container classes that already
>>support serialization.  I.e. the MFC code will help compose/decompose
>>objects.
>>
>>--
>>Scott McPhillips [VC++ MVP]
> 
> 
> 

0
7/21/2003 9:03:34 PM
Reply:

Similar Artilces:

How do I send copies emails without sending attachments?
I send emails with attachments to our bank. My boss wants a copy of the email but not a copy of the attachment. How do I do that? Steve Bramblett wrote: > I send emails with attachments to our bank. My boss wants a copy of the > email but not a copy of the attachment. How do I do that? Each recipient gets the SAME copy of the e-mail. If you want different recipients to get different versions of your e-mail, you have to send different e-mails. ...

No message in outbox
I tried to send a message with 1Mb attachment to 40 recipients in the bcc field. It gave me an error message from the isp's server, the message was NOT sent (I've checked), it did NOT arrive in Sent Items, but neither is it in the Outbox any more. I can send and receive email successfully. Problem is, every few minutes Outlook tells me it's sending message 1 of 1, it fails and gives me the same error message. Yet there is no message in the Outbox. But what happened to the original message when it first failed to send? I guess it's 'stuck' somewhere but I can...

Sending mail from selected email address
Hi All, As I have 4 email accounts set up in Outlook, I understand that I can send mail from each or any account. The accounts are listed under tools / Send and Receive / then each of the accounts. How can I choose which account to send from so that the recipient see's who I want it to be from?? Hope that explains it. Regards Alan On Sat, 16 Apr 2005 21:10:48 -1000, The Fatman <albaxter@optushome.com.au> wrote: > Hi All, > > As I have 4 email accounts set up in Outlook, I understand that I can > send > mail from each or any account. > > The acco...

PowerPoint 2003 to accessible Word 2003 via VBA?
I'd like to extract all content from a Windows PowerPoint 2003 document and place it in a Word 2003 document, as Word to PDF conversion seems to provide better-quality tagging than a PowerPoint to PDF conversion. I know I can save the outline as RTF and open that in Word, but the outline does not include any of the following: - text added on a blank slide layout - text in a text box - tables. - images. Is there any way to copy all content from a PowerPoint presentation to a Word document, such that all text remains text and all tables remain as tables? Charles Belo...

Sending a macro to another PC-how?
How do you send a macro you've written to another PC so that they can save it in their Personal.xls file (at Program Files\Microsoft Office\Office\XLStart)? You can export a macro and save it, to do this from your workbook, right-click the workbook's icon and pick View Code. This icon is to the left of the "File" menu this will open the VBA editor, click on the module you want to save and go to file and export file, then save it to a floppy or what ever you backup to, then import it to the new workbook. -- Paul B Always backup your data before trying something new Using ...

Sending mail from remote location
my mail works great while at home. when I go on the road I can receive ail but not send. I get the following error message: Subject 'SKIDOO MACH Z 800LT (long track / long tunnel) (Jackson)', Account: 'Jeff', Server: 'smtp.charter.net', Protocol: SMTP, Server Response: '571 imp11 smtp.charter.net OTcuMTQ3LjE2LjIzMA== You must connect from Charter IP space. E1110', Port: 25, Secure(SSL): No, Server Error: 571, Error Number: 0x800CCC61 It worked on my last laptop and I have not been able to figure it out on this one. I can't remember what I...

cannot move messages
Sometimes when I attempt to move a message from the inbox to a storage folder I receive the following error message - "An unknown error has occured. The selected message(s) could not be moved." Why am I receiving this message and how can this problem be corrected? Any suggestions would be appreciated. Thanks What kind of mail account is it? POP3, IMAP or HTTP? Both IMAP and HTTP accounts synchronize with the mail server, so moving a message from the mail account to the storage folder requires that WLM tell the mail server to delete the message from the server ma...

Send and Recieve Fix
For a long time I had a problem with my Send/Recieve function in Outlook. This happended in both Outlook 2000 and my current version - 2007. I found I had to re-boot my computer to perform a Send/Recieve in Outlook. Otherwise the sequence would start then stop and say it could not perform due to an error. After extensive Internet and News Group research I decided it was time to run a check on disk errors. This Windows XP facility seemed to have fixed my Outlook problem. I did this about a few months ago now and I have since had no problems with my send and recieve. Unfortunately I do have ...

Unable to send?
Hi, I've got MOOL, and i"m usign ti with outlook. The emails that I'm sending are just "stuck" in the outbox? Can anyone give me an idea of what's going on? Rex Did it ever work? Are you able to receive? -- Aloha, -Ben- Ben M. Schorr, OneNote-MVP Roland Schorr & Tower http://www.rolandschorr.com Microsoft OneNote FAQ: http://www.factplace.com/onenotefaq.htm **I apologize but I am unable to respond to direct requests for assistance. Please post questions and replies here in the newsgroup. Mahalo! "Rekks" <rex_flynn@hotmail.com> wrote ...

Sending messages in Outlook
We have a user that everytime that she sends an email she will get booted out of Outlook. The email does go through, but she will have to get out of Outlook. When she goes back into Outlook, everything is fine until she sends another message. Any help would be appreciated. ...

No Permission to Send/Receive Email???
I just replaced our server hardware, upgraded to WS 2k3 Enterprise and created a new domain. I transferred the client files and desktop on our desk/laptop computers over to the new domain. We do NOT have Exchange installed yet, but use Outlook 2002 with the email etc. saved on the client. One one client machine (mine), the email, calendar, etc are there, but when I hit the Send/Receive button, I get a message saying that I don't have permission to perform this operation. Also when I try and change the automatic check for email option it tells me I don't have permission. ...

urgent (high importance) messages #2
Is there a way to remove the high importance flag from messages sent through Exchange 2003? We have a number of users that always set this flag even though the subject matter of the message is not important at all. Thanks Might be, in one of the policies that are Outlook/Office based? Sorry can't be more specific than that... JeffG On Thu, 10 Feb 2005 04:53:03 -0800, "Scott" <Scott@discussions.microsoft.com> wrote: >Is there a way to remove the high importance flag from messages sent through >Exchange 2003? > >We have a number of users that always set ...

Send Do Not Send
When I attempt to email via a print server - OutLook Express displays the message "A program is attempting to email on your behalf" Send or Do Not Send - How do you prevent this from happening? And just automatically send? ...

Sending on behalf... Exchange 2003
Hi everyone, Is there a better way to give a few users the ability to send mails also from the info@domain.com mailbox without having them logout and login to a different Outlook 2003 profile... Or without the text sending on behalf of... So my question is, Is there an easy way that a user can select another e-mail address and send mails out...? Thanks a lot in advance!! Regards, BY On Thu, 05 Oct 2006 12:57:12 GMT, "BY" <nospam@mail.com> wrote: >Hi everyone, > >Is there a better way to give a few users the ability to send mails also >from the info@dom...

What was Outlook sending?
Hi, I downloaded my messages using the option "send and receive all". However, the "Show Progress" box indicates that I was also 'sending something'. But I had nothing to send! I look in the "Sent items' folder and nothing was sent at this time. What was Outlook 2003 doing? Santista The usual response here is, "You have a virus". It could be that a virus program is using your Outlook to send spam and/or a copy of itself to people in your address book. I hope this is not the case, but please have the foresight (aftersight?) to look into ...

'SEND' just sends it to the OUTBOX
Outlook 2007 on WinXP Home SP3. When I click 'SEND' when replying to an email it does not SEND but puts it in the OUTBOX. I have to click SEND/RECEIVE from the main page to actually SEND the email. Is there a setting I am missing? Thank you. "Peter" <lysdexic@hotmail.com> wrote in message news:eoOd1BM$KHA.5536@TK2MSFTNGP02.phx.gbl... > Outlook 2007 on WinXP Home SP3. When I click 'SEND' when replying to an > email it does not SEND but puts it in the OUTBOX. I have to click > SEND/RECEIVE from the main page to actually SEND the emai...

Outlook Can't Send Messages
This morning I fired up Outlook 2007 (running under Windows 7). It retrieved all new emails. I then tried to post a new email, (not a reply). However, the nano-second that I clicked on "Send" I received a reply from "System Administrator". It said this: Your message did not reach some or all of the intended recipients. Subject: The Train Meltdown Sent: 27-Jul-10 1:18 PM The following recipient(s) cannot be reached: xxxxx@xxxxx.com.au on 27-Jul-10 1:18 PM None of your e-mail accounts could send to this recipient. I have 3 active email ac...

Rules Wizard and Send/Receive error
A couple of days ago, I received an alert from Norton Antivirus software that the file "belt.cab" was corrupted but could not be deleted. Fearing the worst, I manually deleted the file. Since then, Outlook appears to be completely disabled, with the symptoms being that several commands have disappeared from the Tools menu including Send/Receive (both), Rules Wizard, Out of Office Assistant. I can compose an email, but it will not send. I have checked my email accounts and all appears to be in order. Even after a complete reinstall, I cannot send/receive email. The on...

sending Access files
Is there a quick and easy way to send access files without Outlook blocking them. I exchange files with a limited selection of people so am happy that what I am sending and receiving is OK. I know that I can use WizZip but the knowledge database also suggests changing the .mdb extension. I don't know how to do this. Do I just right click over the file and choose open with Word? Or maybe there is a simpler way. Thanks When you send a file type that on Microsoft's potentially dangerous list, you get a message informing you that the recipient may not be able to access the file on...

Multiple Send to
Dear Experts, In any Document Library you have a Send To drop down option. This can only be configured once that is only one entry. I have to have 7 Custom Send To options. Does anyone know how to create more than 1 Sent To? Best Regards, -- Girish J Bhatia MOSS Certified, SharePoint Certified, MCSE2003, MCDBA, CCNA, CCNP, CCSA ...

Trying to send emails from an external program
I am trying to send email from my accpac software and it makes me allow the email everytime. Is there a way I make my Outlook 2007 accept Accpac as a reliable source for sending emails?? tammy0005 wrote: > I am trying to send email from my accpac software and it makes me allow the > email everytime. Is there a way I make my Outlook 2007 accept Accpac as a > reliable source for sending emails?? MapiLab's security add-on (free) ...

Absolute VS relative macro
Hi Again I read that to make a macro "relative" you select Tools>Macro>record new macro and then select RELATIVE I do not have a box with that option Where did it go Thanks I got that far but all I see on the STOP record tool bar is St , a hafl diamond pointing down, and X I do not see a button that would allow me to record in ABSOLUTE or Relative mode Help "Ron de Bruin" <rondebruin@kabelfoon.nl> wrote in message news:uxn7JhUUDHA.2196@TK2MSFTNGP12.phx.gbl... > There is a button on the Stop Recording toolbar pcor > > -- > Regards Ron de Bruin &...

Can teams OWN objects?
It seems as though in version 1.2, teams cannot own objects...whereas version 1.0's documentation suggests that objects CAN own objects. In Version 1.0 objects can be assigned to (OWNED) or shared with Teams. In Version 1.2 objects can only be shared with teams. Can anyone confirm this? RF Yes, team can't own objects, but objects can be shared with them. No, object are only own by employee, users or group. However you can share information within team (that their purpose) Antoine "RF" <anonymous@discussions.microsoft.com> wrote in message news:<179df01c4...

still problems with Exchange 2010 and sending to certain domains
We have done the following: made sure the PTR records matches the IP address of the send connector created an SPF record we are still having issues sending to certain domains and we are at a loss. I've done plenty of 2007 systems and never had this issue. What are we doing wrong? It simply doesn't make sense. Do you get an error message back from the receiving server? JE. On 1/26/2010 10:14 AM, Gene Whitley wrote: > We have done the following: > > made sure the PTR records matches the IP address of the send connector > > created an...

Microsoft Outlook Connector Error: x no available message stores
When setting up Sync via USB with Blackberry Curve Bold 8900 with Blackberry Desktop Manager. Details: Outlook 2007 (Enterprise Edition) on Vista Home Premium 64. Have tried: Re-naming Mapi32.dll to Mapi32.dll Tried to do fixmapi in System32 but when I clicked on it nothing happened. No exe file extension. Mail app in Control Panel has disappeared so I could try to build new profile. Full System restore. No joy. Just a lot of work. Uninstalling Outlook 2007 and installing Outlook 2003. Uninstalling Office 2007 and installing Office 2003. Any help would be much appreciated... -- b...