c++ - Sending large chunks of data over Boost TCP? -


I have to send network data to a computer via TCP ... these tables can be rather large to send them to TCP I am finding it hard to think about what will be the best way, because I do not know much about network programming.

Here is my basic class structure that I need to fit in Buffers to be sent through TCP:

  class primitive selection {std :: vector & lt ; Primitive * & gt; the ancient; }; Class primitive {PRIMTYPES primType; // PRIMTYPES is only an NM with values ​​for the fan, bar, etc. ... unsigned integer content; Std :: vector & lt; Vertex * & gt; Corners; }; Class vertex {float x; Float Y; Float z Floating xenomal; Float xnormal; };  

I am using the Boost Library and their TCP stuff ... It is easy to use. You can just fill a buffer and send it through TCP.
Of course, this buffer can only be so big and can be up to 2 megabytes of data to send me.

What is the best way to get the above class structure and send it to the network in the required buffers?

Edit: After reading this again I know that this is actually a more common problem that is not specific for Boost ... to trick the data And there is another problem for sending it. Although I am still interested in seeing whether there is anything in Boost that this essence can be some abstract.

Tried of Boost with TCP? I do not know why 2 MB will be the issue of transfer, I'm assuming that we are talking about a LAN running at 100 Mbps or 1 Gbps, a lot of RAM and a computer with 20ms response time is? If your goal is to get 2 MB from one computer only then send it, just TCP will handle this piece for you.

I have a TCP latency detection tool that I wrote with Boost, who tries to send buffers of different sizes, I regularly check up to 20 MB and they have no problem Get through.

I think what I am trying to say, unless you have any problems, do not waste time in developing solutions: -)

- ------- Solution implementation --------

Now that I have spent a few minutes on my hands, then I talked to you and hasten what you were talking about Implemented: Three large parts:

Serial / deserializer, promote your own, but it is your own More than rolling the better not, so I did.

Sender - connects to receiver on TCP and sends data

Receiver - Waiting for connection from sender and unpacking the data it receives.

I zip in Exe (s) is included, sender, xac / receiver.xa - to view options, or just look at the main.

More detailed explanation: Open two command prompts, and go to DataChunker \ Debug in both. In the second one run sender Run in Exe (possible on a separate computer, in which case --remote-host = IP.ADD.RE.SS after executable name, if you want to try send more than once and send ten times - -New-dispatch = 10). Looking at the code, you can see what is going on, the receiver making the sender and the sender (TCP socket) in the main () tasks, the sender prepares a new primitive selection and fills it with some example data, then Serializes and sends it ... the receiver removes the data in a new primitive selection, at that point the primitive collection can be used by any other person, but I have written

Edit: For example, github has been transferred.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -