Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9140475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:31:16+00:00 2026-06-17T09:31:16+00:00

For a client/server application I need to send and recive c++ objects. I don’t

  • 0

For a client/server application I need to send and recive c++ objects. I don’t need the corresponding classes to do anything fancy but want to have maximal performance (regarding network traffic and computation). So I though of simply transferring them as binary strings. Basicly I want to be able to do the following

//Create original object
MyClass oldObj();

//save to char array
char* save = new char[sizeof(MyClass)];
memcpy(save, &oldObj, sizeof(MyClass));

//Somewhere of course there would be the transfer to the client/server

//Read back from char array
MyClass newObj();
memcpy(&newObj, save, sizeof(MyClass));

My question: What does my class need to fullfill in order for this to work?
Naturaly Pointers as members won’t work when transferring to another application. But is it sufficient that my Class is considered POD (in c++03 and/or c++11) and does not have any pointers or equivalents (like STL containers) as members?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:31:17+00:00Added an answer on June 17, 2026 at 9:31 am

    Both machines need to:

    1. Have the same Endianess (for int)
    2. The same floating point representation (double)
    3. The same size for all types.
    4. The Same compiler
    5. The Same flags used to build the application.
    6. Pointers dont transfer well.

    BUT the network is going to be the slowest part here.
    The cost of serializing most objects is going to be irrelevant compared to the cost of transfer. Of course the bigger your object the higher the cost but it takes a while before it is significant to make a dent.

    The higher cost of maintenance is also you should factor in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create Client/Server application to send files from clients to Server. I
I need advice. My server application send objects with not inialized proxies. Primitive types
I've a tcp based client-server application. I'm able to send and receive strings, but
I am working on Client Server application where I need to send 6 byte
I want to create client-server GPS tracking application that clients send location data to
I'm looking to a design a protocol for a client-server application and need some
I have a client server application in which I need to transmit a user
I have a client server application in which the server and the client need
I have some client-server application. And as one of its part, I need to
I'm developing client-server application by using .Net, C#, WCF, WPF. And now I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.