Click here to Skip to main content
15,445,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey Codeproject,

I am currently developing my own .NET(TCP) protocol, but I had a bit of a problem. Assuming our buffer is 4096 in length, and we have a database that would be serialized for instance to 40096(40 megabytes), how could we synchronise this, [Edit] as in that they keep on having the same variable, because we can only send 4096 bytes. Any ideas?
Updated 7-Jun-13 11:36am
Sergey Alexandrovich Kryukov 7-Jun-13 17:58pm     CRLF
Not clear... What defines you buffer size? (But of course, it will always less than you whole database size. :-) What's the problem? —SA

1 solution

I would say you buffer all your data and then send out the first batch of 4096 and then the second batch of 4096 and so on.
Let your client collect all this data in another buffer and then process it as when it is required.

The problem with this approach is that you will need to make sure all your sets are reaching the client.
For this you can, say, send out a flag denoting the sequential number of the packet.

The client can make sure that he receives all packets. If any is missing. he should be able to request for the same packet again.
Share this answer
Deviant Sapphire 8-Jun-13 12:27pm    
Yeah, I was thinking that I had to do this. Thanks a lot. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900