So who is Julien???? Whoever Emmanuel called out on this issue has
been quite silent on this list...
I have dug some more on this issue and can confirm that the filter hooks
are ONLY being called with data on the non-serial connections. Serial
connections never see the encoded byte stream as it has been sent to the
port; though we do see the 0-byte packets that Mina uses as flags.
This applies to the outbound side of the filter chain only. The
received data hook is being called fine regardless of connection type.
This applies to Serial connections only. The sent data hook is being
called fine for socket-based connections.
Any help at all would be greatly appreciated!
boB
Emmanuel Lecharny wrote:
boB Gage wrote:
Hi,
Hi,
I am working on a MINA-based application that communicates with a
wide variety of manufacturers' devices, some are serial, others use
socket connections. All have been designed to be
transport-transparent, allowing us to simulate devices and specific
situations via socket-based simulator.
I added a CaptureLogFilter object to log data flow to a separate
file. I hook that object into the filter chain as each connection is
created.
Inside CaptureLogFilter, in both messageSent() and messageReceived()
hooks, I check the message parameter, and if it is an IoBuffer, I spit
out a capture line SENT (or RECEIVED) + # of bytes + a hex dump of those
bytes.
For simulated data sets (socket-based connections) this works great, my
capture log shows
SENT x bytes blah blah blah
SENT 0 bytes
RECEIVED y bytes blah blah blah
The extra "SENT 0 bytes" seemed odd but harmless.... until I noticed
what happens on serial connections. For those I invariably see:
The SENT 0 bytes is an artefact, produced in the encoder. It is used
to update some statistics. When the Head receive an IoBuffer with 0
bytes in it, it assumes thaat a message has been sent, and increment
the associated counter. Obviously not the best way to count the number
of messages... Anyway. This is the reason you get this SENT 0 bytes.
SENT 0 bytes
RECEIVED y bytes blah blah blah
Each and every SENT line from a serial-based connection reads 0 bytes,
and I never see the actual command packet that I sent out. It seems
apparent that said data was received by the far end device, as the
RECEIVED lines show all the right responses, but my log only contains
half the conversation since all the SENT lines erroneously report "0
bytes."
I have no idea about why you don't get the number of sent bytes when
using the Serial-based connection. Julien ?