|
Boost Users : |
Subject: [Boost-users] Transmitting serialized data of multiple types and variable length over a socket
From: A.Agrawal_at_[hidden]
Date: 2009-08-26 00:37:15
Hello,
I am new to boost (few months).
I have a client - server situation where there can be multiple clients
(Linux or Window) connected to one server (Linux). Clients send requests
and Server sends response to the clients. Server also sends new updates
which the clients will keep receiving.
The request /response has following structure:
struct Message {
uint8_t data_name;
uint16_t count_of_data_records; //
uint16_t data_len; //length of serialized_data
string serialized_data; //serialized_data is binary serialized data
using boost serialization.
};
We have 6 types of structs (identified by data_name) that are serialized
into serialized_data. I understand that I have to send two buffers one
(ASCII buffer) with data_name, count_of_data_records and data_len and
other binary buffer. I have seen example:
http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/example/serialization/connection.hpp
Questions:
1. I am not sure if I should use synchronous or asynchronous
communication, I am inclined towards synchronous.
2. What is the best way to send this data across from a server to multiple
clients and from one client to one server.I don't know the best way to
implement it. Please advise what is the best way or if you know of an
example.
Regards,
Anil Agrawal
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net