Ticket #1796 (closed defect: wontfix)

Opened 3 months ago

Last modified 3 months ago

Protocol Buffers two deserializes

Reported by: Xylios Owned by: murphy
Priority: major Milestone:
Component: murphy/protobuf.plt Keywords:
Cc: Version: (1 1)
Racket Version:

Description

Hello,

Me and my colleague are using your implementation of Protocol Buffers for Racket.
However we are having some issues using the Serialize and Deserialize commands.
At the moment we are using as output a file, using the binary mode and if something exists on the file we use append.

(define output (open-output-file "D:\\DocumentsD\\test.bin" #:mode 'binary #:exists 'append))

Our idea is to serialize two messages

(serialize (strct* #:x 100 #:s "test1") output)
(serialize (strct* #:x 200 #:s "test2") output)

Followed by two deserialize

(define str1 (deserialize (strct*) input))
(define str2 (deserialize (strct*) input))

Unfortunately, we get the following error
deserialize: missing required fields: (seteqv 1 2)
This happens when we do the second deserialize.

str1 contains the second serialize, x = 200 s = test2

Can you help us find a solution to this problem?

If you would like to see the code, the full source is in the end of this ticket.

Thank you for your time,
Guilherme Barreto
Student @ IST (Técnico, Lisboa)

#lang racket
(require (planet murphy/protobuf:1:1))
(require (planet murphy/protobuf/syntax))
(require (planet murphy/protobuf/encoding))

(define output (open-output-file "D:\\DocumentsD\\test.bin" #:mode 'binary #:exists 'append))

;;The contract
(define-message-type strct ([required primitive:int64 x 1] [required primitive:string s 2]) )

;;Racket sending the message
(serialize (strct* #:x 100 #:s "test1") output)
(serialize (strct* #:x 200 #:s "test2") output)

;;Close output port
(close-output-port output)

(define input (open-input-file "D:\\DocumentsD\\test.bin" #:mode 'binary))

(define str1 (deserialize (strct*) input))
(define str2 (deserialize (strct*) input))

;;Close input port
(close-input-port input)

Change History

Changed 3 months ago by Xylios

  • status changed from new to closed
  • resolution set to wontfix

Changed 3 months ago by murphy

This issue is an accidental duplicate of #1795, an explanation why this is not a bug can be found there.

Note: See TracTickets for help on using tickets.