rosnodejs icon indicating copy to clipboard operation
rosnodejs copied to clipboard

[tcppros - subscriber] connection header are checked for every tcp packet

Open maxired opened this issue 13 years ago • 2 comments
trafficstars

Hi,

using the thc ros stacks, I've been faced to a problem. Being a subscriber , once a conneciton with another node is establised, the first message contains the connection header. Others packets does'nt contains this header.

In the implementation, we check for the header for every packet. This sometimes lead to serious problems.

(In our implementation, i'm not sur if we are realy using the header, because we got all the needed information before).

maxired avatar Jul 12 '12 07:07 maxired

In deserializeMessage, it should be checking if a Connection Header is part of the packet or it's a standalone message (these lines specifically).

I'm sure there's a more efficient way of doing this though. See Issue #1.

baalexander avatar Jul 12 '12 15:07 baalexander

Hi, I was not aware of issue #1. I'm not sure to understand the comments

" // If the initial length is less than the buffer, then a connection header was
  // sent first as part of this buffer."

You got to be careful, it's not impossible that two or more messages was sended in the same packets.

From what I understood, the Connection Header is always sended as a first "message" once the connection is established. That's means that when reading the first packet, you can skip the Header before the message. The header length is buffer.readUInt32LE(4);

maxired avatar Jul 12 '12 20:07 maxired