On 18/03/16 09:00, Stefano Miccoli wrote:
I spotted another difference:
owwrite messages are NOT null terminated, but perl OWNet ones yes.
I remember a short discussion on this list in which I asked if
owserver messages should be null terminated. I think that Paul changed
the code to reflect my observation, see the thread:
https://sourceforge.net/p/owfs/mailman/message/32206205/
(BTW my suggestion was to keep the null terminator, just add it to the
definition of the owserver protocol, but my impression is that Paul
changed the code to make the null terminator unnecessary.)
The timeframe is consistent with the regression analysis already done.
My guess is that this null terminator is the source of the problems.
My suggestion: add to the source tree a formal description (RFC
style??) of the owserver protocol, so that it is clear if the error is
client-side or server-side, and only then proceed to patch owserver or
OWNet.pm, should this be the problem
Stefano
I've patched OWNet.pm in master now, to not send a null-terminated
payload. The main issue was that that the payload field held the
null-terminated length of full payload, but the size field held the
non-null-terminated length (of the data). This confused the server which
calculates the end-of-path portion as "payload length - size". When
Payload length was +1 (for null), but size was for non-null length, the
first character was lost.
Regarding the trailing ||, could it be that the LCD unit displays a \0
(custom char 0, for HD44780?) as ||?
We could skip the \0 on the path too, but the server would do an extra
memmove and internally null-terminate it anyway.. So leaving that as-is now.
Andy, Nico, can you please try the master branch?
Alternatively, just patch OWNet.pm:
@@ -367,8 +367,8 @@ sub _BonjourLookup($) {
sub _ToServer ($$$$;$) {
my ($self, $msg_type, $size, $offset, $payload_data) = @_ ;
my $f = "N6" ;
- my $payload_length = length($payload_data) + 1 ;
- $f .= 'Z'.$payload_length ;
+ my $payload_length = length($payload_data);
+ $f .= 'A'.$payload_length ;
my $message =
pack($f,$self->{VER},$payload_length,$msg_type,$self->{SG}|$self->{PERSIST},$size,$offset,$payload_data)
;
Johan
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers