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 3223116
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:04:11+00:00 2026-05-17T16:04:11+00:00

I have a client and a server I want to send objects from client

  • 0
  • I have a client and a server
  • I want to send objects from client to server
  • The objects must be send bundled together in a “big packet” containing many objects
  • The objects could be in a random order
  • The number of objects is not fixed
  • There could be objects in the packet which are unknown to the server (so he needs to dump them)

I haven’t got much experience with Serialization.
I would prefer Boosts Serialization-framework (if thats possible with it)
I thought of the following concept
(incomplete Pseudocode, inspired by C++, no specific Boost::Serialization-code):

class SerializableObject
{
    virtual int getIdentifier() =0;
    virtual Archive serialize() =0;
}
class SubclassA : public SerializableObject
{
    int getIdentifier() { return 1; }
    Archive serialize() { ... }
    ...
}
class SubclassB : public SerializableObject
{
    int getIdentifier() { return 2; }
    Archive serialize() { ... }
    ...
}

Now on Clientside:

void packAndSendData()
{
    archive << objectA.getIdentifier();
    archive << objectA;
    archive << objectB.getIdentifier();
    archive << objectB;
    myNetworkObject.sendData(archive);
}

On Serverside:

void receiveAndUnpackData()
{
    archive = myNetworkObject.receiveData();

    while(archive.containsObjects()) //possible?
    {
        int type = archive.deserializeNextObject();
        if(type == 1)
            SubclassA objectA = archive.deserializeNextObject();
        if(type == 2)
            SubclassB objectB = archive.deserializeNextObject();
        else
            archive.dropNextObject(); //How to do this? Possible?
    }
}

So the questions are:
– Is this a good concept or are there other possibilities?
– Is such a concept possible with Boost::Serialization
– If not: Are there other libs which could help implementing the concept?

I’ve tried to compress the problem as much as possible and to give as much info as I could. Hope it is understandable what I meant and what I try to achieve.
If anyone has a better title for this question please fix the existing one, I had no idea of how describing this question with all of its aspects.

  • 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-05-17T16:04:12+00:00Added an answer on May 17, 2026 at 4:04 pm

    The approach you describe is a start, but have you thought about how you’d serialise references between objects. I.e. serialising an object graph. Also, if you may need to think about data format versioning if your client and server can change out of sync with each other. Its not necessarily a simple problem.

    Are there other libs which could help
    implementing the concept?

    You could look at Google’s Protocol Buffers project. It probably does what you want, and is language neutral.

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

Sidebar

Related Questions

I want to upload files from a client location to a server. At present,
I want to create a server and client that sends and receives UDP packets
I have a socket server which I am writing in C++ and a client
I want to have an class like this, public class Apple { public string
I work for a large organization that supports many different sites on a nation
I'm looking for possible solutions for the following scenario: I have a service that
Let's say I have a class like so: class Gerbil{ int id; float x,y,z;
We have a Windows application on .net 2.0 that uses embedded encrypted database. The
My application (.net 3.5 sp1) uses the HttpWebRequest to communicate with different endpoints, sometimes
SOCKET lhSocket; int iResult; lhSocket = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); char *sendbuf = this is a test;

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.