Comments (5)
Thanks for the info and patch; before I commit the patch, I just want to
quickly look
into how DataAvailable behaves with respect to buffering - i.e. is it likely to
incorrectly thing it has the end of the batch, when actually some is still
buffered
at the client.
For info - one option for network usage is the "...WithLengthPrefix" methods
(in the
HEAD, but maybe not in the downloadable dll) - this sends the length of each
batch
first, which makes network usage very simple: it knows it is expecting <x>
bytes, so
it stops cleanly after <x> bytes (see the QuickStart project for an example).
Thanks again - I may well end up applying that patch (once I have checked how
it
behaves: I'll be honest - raw sockets isn't my usual thing...).
Marc
Original comment by marc.gravell
on 3 Oct 2008 at 6:02
- Changed state: Started
from protobuf-net.
I've done some checking, and general consensus is that DataAvailable cannot be
used
(robustly) to prove that the batch is complete; it simply indicates that the
receive
buffer is empty, which isn't the same thing: if this happens to fall at the
point
between fields, then data corruption will occur.
The recommendation given was to use a length-prefix if working with batches,
which is
what the QuickStart already does. Of course, if you are just sending one batch
you
can serialize and Close() the stream, which will work just as well - but if you
want
a dialogue over the socket it should use a length prefix.
If I've got it wrong, please say...
Original comment by marc.gravell
on 3 Oct 2008 at 7:46
- Changed state: WontFix
- Added labels: Type-Other
- Removed labels: Type-Defect
from protobuf-net.
Thanks for looking into it. I didn't try the WithLengthPrefix methods, as it
wasn't
in revision 164, and i just updated to 171 to see if the bug I was experiencing
was
fixed in the newer version... Tested again with these methods and it works.
Original comment by [email protected]
on 3 Oct 2008 at 9:44
from protobuf-net.
You are right, of course - it [a conversation over a NetworkStream] simply
didn't
work in r164, which I found when putting together the quick start example;
these
methods were added exactly to fill this gap.
Any other problems, let me know.
Marc
Original comment by marc.gravell
on 4 Oct 2008 at 8:24
from protobuf-net.
Original comment by marc.gravell
on 8 Nov 2008 at 9:27
- Changed state: Verified
from protobuf-net.
Related Issues (20)
- Suffix missing for required non-primitive properties HOT 2
- global:: prefix forgot when generate field and property
- Concurrent dictionarys and linked lists goes null on serializing/deserializing.
- Calling GetSchema can cause call to serialize to throw an exception
- Method to detect built-in types
- Await/async proposal HOT 9
- Invalid proto data with TimeSpan via GetSchema() HOT 1
- Please add Windows Phone 8.1 to PCL version HOT 1
- protobuf-net.2.0.0.668\lib\net40\protobuf-net.dll should target v4.0.30319, not v2.0.50727
- Custom serializer works in debug - not in release HOT 5
- Won't build to Windows Phone 8
- Exception due to code in default constructor HOT 3
- I think with 100 runs of same code on same data I can see all exception of protobuf-net !! HOT 5
- Need Help Getting Started HOT 2
- Protobuf.net 'IsDefined' logical bug?
- Deserializing Dictionary<string, List<T>> leads to An element with the same key already exists in the dictionary.
- sub-classes serialization
- Precompiler failed to process asm which targets .NET Framework 3.5
- Value null exception
- Protobuf error System.Xml.Writer wrong assembly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protobuf-net.