On Wednesday, 1 June 2016 22:25:35 UTC+3, Shawn Milochik wrote:
Thanks, that explains it, if I understand it correctly.

If I'm connected to 24 peers, I need 24 decoders. Is that correct? I
hadn't heard about that before. Also, it works fine with one decoder for 24
peers if they all connect before sending gobs.
I guess the more correct way would be to say 1 decoder can only read 1 gob
stream and only from start to finish. e.g. If you have a broadcasting
server and all clients are connected from the start then the broadcasting
server can write a single stream and broadcast it to clients.

Why is encoding/gob different from encoding/json and encoding/xml in this
Different uses -- gob is more efficient in encoding data and can
dynamically create types (this is also why you need to call gob.Register).
Since you might be connecting different versions, you need those
type-descriptions to describe the binary content.

I'm not sure what you are building, but you might be better off using some
other encoding e.g. protobuf, capnproto or something custom (each having
their own trade-offs, see http://ithare.com/marshalling-and-encodings/).
Based on the for loop you seem to be always sending the type-descriptors,
which can be avoided by specifying the protocol.

+ Egon

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 6 | next ›
Discussion Overview
groupgolang-nuts @
postedJun 1, '16 at 6:36p
activeJun 1, '16 at 7:47p

3 users in discussion

Shawn Milochik: 3 posts Egon: 2 posts Voidlogic: 1 post



site design / logo © 2022 Grokbase