Homework 0 forum

ERROR: empty protobuf packet

 
Picture of Sacha Adrien Bartholmé
ERROR: empty protobuf packet
by Sacha Adrien Bartholmé - Tuesday, 29 September 2020, 14:35
 

Hello,

When my binary sends an UDP packet to the provided test binary via the Gossip Port, the test binary prints "ERROR: empty protobuf packet".

Here are the steps to reproduce the error:

  1. Start the test binary with  ./hw0 -UIPort=10000 -gossipAddr=127.0.0.1:5000 -name=nodeA
  2. In a new shell, start netcat with nc -u 127.0.0.1 5000
  3. In the netcat subshell, type {"originPeerName":"sacha", "relayPeerAddr":"127.0.0.1:44825", "contents":"salut"} where 44825 is the port of the client
  4. The test binary outputs 

    ERROR: empty protobuf packet PEERS 127.0.0.1:4482


    When I do the same with my own binary I do not have this problem.

Picture of Aaron Joos Lippeveldts
Re: ERROR: empty protobuf packet
by Aaron Joos Lippeveldts - Tuesday, 29 September 2020, 17:54
 

You're sending a bare SimpleMessage, instead of one wrapped in a SimplePacket (see packets.go).

It works if you instead do

nc -u 127.0.0.1 5000

{"simple":{"originPeerName":"sacha","relayPeerAddr":"127.0.0.1:44825","contents":"salut"}}