The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: xAP EOM identifier in xAP v1.3



--00c09ffb4c453bf9840473afcb3c
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

I agree that checksums are not appropriate to TCP connections, the
transpor=
t
wrapper already designates them as optional.

I don't think hubs currently send heartbeats? If they do, it's not explicit
in the spec. (Mine doesn't). We also need a mechanism to differentiate
between multiple hubs (since most people will generally run at least one
hu=
b
per vm).

Is a TCP hub going to relay all traffic to all TCP endpoints? That won't
scale very well... but it's also not clear how the filtering etc. will
work=
.
Administering filters manually works fine for the odd serial segment, but
it's not going to be viable for a large number of endpoints.

Heartbeats are broadcast every minute or so typically, so that's going to
result in start up times of up to two minutes for a tcp end point. Is that
acceptable? If not, do we reduce the new tcp hub heartbeat interval? Or is
there a mechanism for an endpoint to poke a hub and elicit a heartbeat?

And lastly, is there merit in some kind of referrer system to allow for
load-balancing and automated failover of tcp connections across more than
one hub? If so, how would this work?

Patrick

2009/9/15 Edward Pearson <edward.mailgroup@xxxxxxx>

>
>
>  I don=92t mean that packet fragmentation or re-ordering are myths =96
ju=
st
> that when dealing with xAP at the IP stack (socket) interface you are
> dealing with datagrams not data packets so you don=92t need to worry
abou=
t
> those packet aspects. There was a design decision to limit xAP
datagrams =
to
> 1500 bytes to improve the likely coverage of correctly sent datagrams
in =
a
> world of IP stacks of varying quality. It=92s no more important than
that=
.
> Readers of the spec seem to attach more importance to it than it needs
> (there=92s the myth aspect).  To program xAP you don=92t need to worry
ab=
out
> fragmentation and reordering =96 just keep your datagrams 1500 bytes
or l=
ess
> and let the stack do its thing.
>
>
>
> Sometimes an app goes a bit wild (xAP news has occasionally been a
useful
> test source) and big xAP messages are generated =96 and they get
delivere=
d
> too! It=92s normally the input buffer of the receiving app (eg hub)
that
> breaks first.
>
>
>
> On the tcp framing, I=92d suggest that implementing the CRC part
(irrelev=
ant
> on a reliable stream) is a waste of most people=92s time; by far more
use=
will
> be made of tcp than any kind of serial/485/etc networks so they=92d be
sh=
aring
> development of an implementation with nobody.
>
>
>
> Discovery can be done simply with the existing hub heartbeat message.
Jus=
t
> need to agree on an extra block that advertises the port number of the
tc=
p
> service =96 which I assume, by default would be 3639.
>
>
>
> Having read the 802.11 spec, I now understand why broadcast udp from
an A=
P
> to a NIC is so un-reliable. And ad-hoc mode is a real disaster!
>
>
>
> *From:* xAP_developer@xxxxxxx [mailto:
> xAP_developer@xxxxxxx] *On Behalf Of *Patrick Lidstone
> *Sent:* 15 September 2009 14:15
>
> *To:* xAP_developer@xxxxxxx
> *Subject:* Re: [xAP_developer] xAP EOM identifier in xAP v1.3
>
>
>
>
>
> Hi Edward,
> Please see in-line responses...
>
> 2009/9/15 Edward Pearson <edward.mailgroup@xxxxxxx>
>
>
>
> The double 0x0a terminator works for me, it=92s simple to implement
=96 a=
lready
> done for my stuff.
>
>
>
> ...but it isn't robust unless the message is sent as a single
datagram, a=
nd
> if it is sent as a single datagram, the os should deliver it as such
-- a=
nd
> if it doesn't, adding an eom marker isn't going to help.
>
>  For reliable streams, such as TCP, I generally frame the messages
with
> STX and ETX.
>
>
>
> I thought all this business about 1500 bytes was somewhat urban myth
(at
> least as it applies to xAP). The data packet size is not what=92s
importa=
nt;
> it=92s how the particular IP stack implementation deals with
>datagrams<
> that=92s the key.
>
>
> I don't understand what you are syaing here? The data packet size is
> inextricably linked to the IP stack. What aspect is it that you
consider =
to
> be an urban myth?
>
>
>  I only have experience of the two most recent Windows stacks (XP and
> Vista) which I agree are likely more capable than old embedded stacks.
My
> experiments with Wireshark show that those stacks will happily deal
with
> fragmentation and defragmentation. 64KB in a single datagram? No
problem =
if
> your receive buffer is long enough (even if you force a small MTU).
>
>  Yes, agreed, OSes perform fragmentation for you. The individual
fragment=
s
> have a maximum size as determined by the MTU. For pragmatic, practical
> reasons, xAP needs to define a maximum overall message size, and for
> convenience's sake that was set as equal to the 'standard' MTU size.
Devi=
ces
> which use a smaller MTU *should *fragment and reassemble seamlessly
> provided that the correct socket options have been set to define the
maxi=
mum
> UDP packet size. By electing to use a single MTU's worth of data, we
we
> avoid the overhead associated with fragmentation and reassembly
(principa=
lly
> memory buffering) which is a good thing. When reassembled, the os
should
> deliver a datagram as a complete entity in one go (irrespective of the
mt=
u
> size, assuming that the datagram falls within the maximum datagram
size
> defined for the stack). If the sender doesn't send a message as a
single
> datagram, then the whole thing falls apart because effectively you are
th=
en
> doing fragmentation and reassembly at the application layer, and that
won=
't
> work because the ordering across datagrams is not guaranteed and
individu=
al
> datagrams may get lost.
>
>
>  If anything goes wrong (eg, missing fragment) the whole datagram is
> dropped. I can=92t see how packet re-ordering can happen on a single
LAN =
for
> broadcast UDP =96 there are no multiple paths and no retry mechanism.
> Certainly never observed it =96 I assume the stack would again just
drop =
the
> entire datagram.
>
>
> Re-ordering of datagrams can occur for multiple reasons on a single
lan. =
A
> sender may send individual UDP packets in any order it chooses. This
> commonly occurs with fragmented packets originating from a
multi-threaded
> sender, which can be interleaved with smaller, non-fragmented
datagrams a=
s
> required (optimising transient memory use, as soon as they are sent,
the
> buffer can be released). A switch is not obliged to retransmit packets
in
> the order in which they are received. And most fundamentally, the
specs d=
o
> not require UDP packets to be ordered so, even if you don't observe
it, i=
t
> *can* happen, and sooner or later interoperability issues will arise
if
> the working assumption is made that they always arrive in order.
>
>
>
> A bigger issue for me, and the reason for me experimenting a few times
wi=
th
> TCP stream serving from hubs, is datagram loss over WiFi networks.
This i=
s
> greatly accentuated for UDP when you use broadcast (as we do) from
wired =
to
> wireless (fine the other way as it=92s not really a broadcast packet
till=
it
> gets to the AP) as the access point and NIC can not longer apply their
> ack/nak procedure at the transport level. I commonly see xAP datagram
los=
s
> rates from wired to wireless connections of 20%. So I=92d like us to
agre=
e on
> a standard transport wrapper for TCP streams which a lot of platforms
wou=
ld
> find useful.
>
>
>
>  I'd suggest using the same framing as the "transport
wrapper", as this
> then allows for code to be shared across transports. If xAP was
extended =
to
> support TCP, then that should also include a formal discovery
mechanism b=
y
> which the IP address/characteristics of the hub can be discovered
(over U=
DP
> xAP?)
>
> Patrick
>
>
>    *From:* xAP_developer@xxxxxxx [mailto:
> xAP_developer@xxxxxxx] *On Behalf Of *Patrick Lidstone
> *Sent:* 14 September 2009 14:19
> *To:* xAP_developer@xxxxxxx
> *Subject:* Re: [xAP_developer] xAP EOM identifier in xAP v1.3
>
>
>
>
>
> So the xAP delimiters for serial are defined in the 1.2 xAP spec here:
>
> http://www.xapautomation.org/index.php?title=3DProtocol_definition#Transp=
ort_Wrapper
>
> To the best of my knowledge, the MTU size for an ethernet frame is
1518
> bytes, which leads to a UDP packet MTU of 1500 bytes and this is the
size
> that is adopted by the majority of operating systems. Internet routers
(i=
.e.
> ISPs) sometimes use an MTU of 576 bytes, but this wouldn't be relevant
to
> xAP since the traffic doesn't pass over the wider net, or if it does,
it'=
s
> generally gatewayed via a TCP/IP connection.
>
> If a device is receiving fragmented UDP packets, I think the same
issues
> arise as those related to extending the xAP message size beyond 1500
byte=
s -
> what happens if a fragment gets discarded.
>
> If you take the scenario:
>
> Part 1(a), Part 1(b), Part 2(a), Part 2(b), Part 3(a), Part 3(b)
>
> --- first there is no guarantee that the parts will be delivered in
order=
,
> and second, if part 1(b) was dropped, and you were blindly assembling
> messages based on the proposed double-0a terminator, you'd end up with
a
> message comprising part 1(a), 2(a) and 2(b) which is not only
obviously
> corrupt, but also possibly larger than the maximum xAP message size,
blow=
ing
> away your buffers.
>
> I think the solution is to probably parse incoming messages on the
fly,
> byte-by-byte. You can then at least reset your state when you
encounter t=
he
> xap-header, and if you count open and close curly braces, you can tell
wh=
en
> you have an apparently complete message. This won't solve the issue of
UD=
P
> fragments being potentially received out of order, but so long as we
are
> dealing with a single LAN, and fragmentation occurs at the receiver,
we w=
ill
> be ok I think.
>
> It is absolutely possible for UDP packets to be discarded, and the way
we
> deal with this in xAP is to accept that this can happen to xAP
messages, =
and
> layer application level acknowledgements where knowing that a message
has
> been received is critically important - whether explicitly or
implicitly
> through status messages. There are various schemes that could be
adopted =
to
> allow a receiver to detect lost messages (e.g. sequence numbering),
but t=
hey
> quickly become quite onerous, and assume that the originator keeps a
copy=
of
> the original message or is able to reconstruct it - which is
non-trivial =
for
> the many xAP nodes.
>
> Perhaps you can share more of the specific details of the device(s) in
> question (manufacturer, docs, o/s etc), and their specific behaviour,
whi=
ch
> seems a bit anomalous?
>
> Patrick
>
> 2009/9/13 Kevin Hawkins <yahoogroupskh@xxxxxxx>
>
> One of the issues seems to be that there is conflicting views as to
the
> length of a a UDP data packet payload.  Some people cite 500 or 512
> characters and some 1500.  Regardless in some low memory/performance
> devices it is being reported, that even with UDP,  packets are being
> received from the buffer either truncated or appended back to back.
> The latter I assume is due to the speed of the device in servicing the
> buffer.
>
> We have an opportunity to protect against this with v1.3 and the
double
> '0A' seems the most compatible.   I would be loathe to support
anything
> that wasn't backward compatible.
>
>   K
>
>
> Patrick Lidstone wrote:
> >
> >
> > I will dig it out - it included an optional checksum I think, and
IIRC
> > was framed by stx and etx (a kind of pseudo industry standard). I
> > certainly used it with the PIC serial stuff and the xAP-serial
bridge.
> > Re.: long message truncation and concatenation: If we need to
support
> > messages that are larger than one UDP packet, then there are
> > additional complexities and the proposed scheme won't work as
intended
> > as the ordering of UDP messages is not guaranteed. I'm happy to
help
> > refine a spec to support these capabilities, but it is moving
away
> > from the basic ethos of xAP somewhat, as devices would have to be
able
> > to buffer received messages, and that raises the bar
considerably.
> > Perhaps there is scope for co-existence of a long and standard
message
> > protocol though?
> >
> > Patrick
> >
> > 2009/9/13 Kevin Hawkins <yahoogroupskh@xxxxxxx
>
> > <mailto:yahoogroupskh@xxxxxxx>>
>
> >
> >     ... Oh ... where is that in the spec ?  it might be all we
need.
> >
> >        This is also tied in with some aspects of long message
truncatio=
n
> >     and concatenation of messages received in UDP receive buffers
> >     though...
> >
> >      K
> >
> >     Patrick Lidstone wrote:
> >     >
> >     >
> >     > The original xap spec provides extensions for framing a
message
> over
> >     > async serial which also delimit the start of the message
- you
> don't
> >     > need this 'hack' if you follow the original spec for
non-UDP
> >     transports.
> >     >
> >     > Patrick
> >     >
> >     > 2009/9/13 Kevin Hawkins <yahoogroupskh@xxxxxxx
> >     <mailto:yahoogroupskh@xxxxxxx>
>
> >     > <mailto:yahoogroupskh@xxxxxxx
>
> >     <mailto:yahoogroupskh@xxxxxxx>>>
> >     >
> >     >       We have been asked on several occasions how to
detect the
> >     end of a
> >     >     xAP messager as there is no unique EOM character. 
Typically
> >     in any
> >     >     reasonable sized packet structured transport eg UDP
then the
> >     packet
> >     >     provides such an indication but on systems with
small packets
> or
> >     >     non eg
> >     >     asynchronous serial this is not useable.
> >     >
> >     >       In discussing this with the specification team we
must
> >     consider
> >     >     backwards compatability and so we do not wish to
alter the
> >     >     specification
> >     >     to include a unique EOM character.  What we do
propose
> >     however is that
> >     >     xAP v1.3 will specify that all messages should end
with two
> >     >     consecutive
> >     >     chr(10)'s immediately after the closing '}'
> >     >
> >     >     ie  ..... 7D 0A 0A
> >     >
> >     >      Some apps, even v1.2 ones,  already do this.  We
don't
> >     believe this
> >     >     will cause any backwards compatibility issues and it
will
> >     always be
> >     >     unique within a xAP message.
> >     >
> >     >      So, in developing xAP v1.3 apps could you therefore
append
> >      two 0A's
> >     >     at the end of your messages , and of course handle
incoming
> >     messages
> >     >     containing such.
> >     >
> >     >       K
> >     >
> >     >
> >     >     ------------------------------------
> >     >
> >     >     Yahoo! Groups Links
> >     >
> >     >
> >     >        mailto:xAP_developer-fullfeatured@xxxxxxx
> >     <mailto:xAP_developer-fullfeatured@xxxxxxx>
> >     >     <mailto:xAP_developer-fullfeatured@xxxxxxx
> >     <mailto:xAP_developer-fullfeatured@xxxxxxx>>
> >     >
> >     >
> >     >
> >     >
> >     >
> >     >
> >
> >
> >
> >     ------------------------------------
> >
> >     Yahoo! Groups Links
> >
> >
> >        mailto:xAP_developer-fullfeatured@xxxxxxx
> >     <mailto:xAP_developer-fullfeatured@xxxxxxx>
> >
> >
> >
> >
> >
> >
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
>=20
>

--00c09ffb4c453bf9840473afcb3c
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable





<head>

<style type=3D"text/css">
<!--

/* start of attachment style */
.ygrp-photo-title{
clear: both;
font-size: smaller;
height: 15px;
overflow: hidden;
text-align: center;
width: 75px;
}
div.ygrp-photo{
background-position: center;
background-repeat: no-repeat;
background-color: white;
border: 1px solid black;
height: 62px;
width: 62px;
}

div.photo-title=20
a,
div.photo-title a:active,
div.photo-title a:hover,
div.photo-title a:visited {
text-decoration: none;=20
}

div.attach-table div.attach-row {
clear: both;
}

div.attach-table div.attach-row div {
float: left;
/* margin: 2px;*/
}

p {
clear: both;
padding: 15px 0 3px 0;
overflow: hidden;
}

div.ygrp-file {
width: 30px;
valign: middle;
}
div.attach-table div.attach-row div div a {
text-decoration: none;
}

div.attach-table div.attach-row div div span {
font-weight: normal;
}

div.ygrp-file-title {
font-weight: bold;
}
/* end of attachment style */
-->
</style>
</head>
<html><head>
<style type=3D"text/css">
<!--
#ygrp-mkp{
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 14px 0px;
padding: 0px 14px;
}
#ygrp-mkp hr{
border: 1px solid #d8d8d8;
}
#ygrp-mkp #hd{
color: #628c2a;
font-size: 85%;
font-weight: bold;
line-height: 122%;
margin: 10px 0px;
}
#ygrp-mkp #ads{
margin-bottom: 10px;
}
#ygrp-mkp .ad{
padding: 0 0;
}
#ygrp-mkp .ad a{
color: #0000ff;
text-decoration: none;
}
-->
</style>
</head>
<body>



<!-- **begin egp html banner** -->

<br><br>

<!-- **end egp html banner** -->


I agree that checksums are not appropriate to TCP connections, the
transpor=
t wrapper already designates them as optional.<br><br>I
don&#39;t think hub=
s currently send heartbeats? If they do, it&#39;s not explicit in the
spec.=
(Mine doesn&#39;t). We also need a mechanism to differentiate between
mult=
iple hubs (since most people will generally run at least one hub per vm).
<=
br>
<br>Is a TCP hub going to relay all traffic to all TCP endpoints?
That won&=
#39;t scale very well... but it&#39;s also not clear how the filtering
etc.=
will work. Administering filters manually works fine for the odd serial se=
gment, but it&#39;s not going to be viable for a large number of
endpoints.=
<br>
<br>Heartbeats are broadcast every minute or so typically, so
that&#39;s go=
ing to result in start up times of up to two minutes for a tcp end point.
I=
s that acceptable? If not, do we reduce the new tcp hub heartbeat
interval?=
Or is there a mechanism for an endpoint to poke a hub and elicit a heartbe=
at?<br>
<br>And lastly, is there merit in some kind of referrer system to
allow for=
load-balancing and automated failover of tcp connections across more than =
one hub? If so, how would this
work?<br><br>Patrick<br><br><div
class=3D"gm=
ail_quote">
2009/9/15 Edward Pearson <span dir=3D"ltr">&lt;<a
href=3D"mailto:edward.mai=
lgroup@xxxxxxx">edward.mailgroup@xxxxxxx</a>&gt;</span><b=
r><blockquote class=3D"gmail_quote"
style=3D"border-left: 1px solid rgb(204=
, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">







=20=20=20=20=20=20=20=20










<div bgcolor=3D"white" link=3D"blue"
vlink=3D"purple" lang=3D"EN-GB">




<br><br>






<div>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">I don=92t mean=
that packet fragmentation or re-ordering are
myths =96 just that when dealing with xAP at the IP stack (socket)
interface you are dealing with datagrams not data packets so you don=92t
need to worry about those packet aspects. There was a design decision to
li=
mit
xAP datagrams to 1500 bytes to improve the likely coverage of correctly
sen=
t
datagrams in a world of IP stacks of varying quality. It=92s no more
important than that. Readers of the spec seem to attach more importance to
=
it than
it needs (there=92s the myth aspect).=A0 To program xAP you don=92t
need to worry about fragmentation and reordering =96 just keep your
datagrams 1500 bytes or less and let the stack do its
thing.</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">Sometimes an a=
pp goes a bit wild (xAP news has occasionally been
a useful test source) and big xAP messages are generated =96 and they get
delivered too! It=92s normally the input buffer of the receiving app (eg
hub) that breaks first.</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">On the tcp fra=
ming, I=92d suggest that implementing the CRC
part (irrelevant on a reliable stream) is a waste of most people=92s time;
by far more use will be made of tcp than any kind of serial/485/etc
network=
s so
they=92d be sharing development of an implementation with
nobody.</span></p=
>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">Discovery can =
be done simply with the existing hub heartbeat
message. Just need to agree on an extra block that advertises the port
numb=
er
of the tcp service =96 which I assume, by default would be
3639.</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">Having read th=
e 802.11 spec, I now understand why broadcast udp
from an AP to a NIC is so un-reliable. And ad-hoc mode is a real
disaster!<=
/span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

<div style=3D"border-style: none none none solid; border-color:
-moz-use-te=
xt-color -moz-use-text-color -moz-use-text-color blue; border-width:
medium=
medium medium 1.5pt; padding: 0cm 0cm 0cm 4pt;">

<div>

<div style=3D"border-style: solid none none; border-color: rgb(181,
196, 22=
3) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium
medium=
; padding: 3pt 0cm 0cm;">

<p><b><span style=3D"font-size: 10pt;"
lang=3D"EN-US">From:</span></b><span=
style=3D"font-size: 10pt;" lang=3D"EN-US"> <a
href=3D"mailto:xAP_developer=
@yahoogroups.com"
target=3D"_blank">xAP_developer@xxxxxxx</a>
[mailto:<a href=3D"mailto:xAP_developer@xxxxxxx";
target=3D"_blank">=
xAP_developer@xxxxxxx</a>] <b>On Behalf Of </b>Patrick
Lidstone<br>
<b>Sent:</b> 15 September 2009
14:15<div><div></div><div
class=3D"h5"><br>
<b>To:</b> <a href=3D"mailto:xAP_developer@xxxxxxx";
target=3D"_blan=
k">xAP_developer@xxxxxxx</a><br>
<b>Subject:</b> Re: [xAP_developer] xAP EOM identifier in xAP
v1.3</div></d=
iv></span></p>

</div>

</div><div><div></div><div
class=3D"h5">

<p>=A0</p>

<p>=A0 </p>

<div>

<div>

<div>

<p style=3D"margin-bottom: 12pt;">Hi Edward,<br>
Please see in-line responses...</p>

<div>

<p>2009/9/15 Edward Pearson &lt;<a href=3D"mailto:edward.mailgroup@blueyond=
er.co.uk"
target=3D"_blank">edward.mailgroup@xxxxxxx</a>&gt;</p>

<div>

<p style=3D"margin-bottom: 12pt;">=A0</p>

<div>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">The double 0x0=
a terminator
works for me, it=92s simple to implement =96 already done for my
stuff.</sp=
an></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

</div>

</div>

<div>

<p>...but it isn&#39;t robust unless the message is sent as a
single datagram, and if it is sent as a single datagram, the os should
deli=
ver
it as such -- and if it doesn&#39;t, adding an eom marker isn&#39;t
going t=
o help. </p>

</div>

<blockquote style=3D"border-style: none none none solid;
border-color: -moz=
-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204,
204);=
border-width: medium medium medium 1pt; padding: 0cm; margin-top: 5pt; mar=
gin-bottom: 5pt;">


<div>

<div>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">For reliable s=
treams, such as
TCP, I generally frame the messages with STX and
ETX.</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">I thought all =
this business
about 1500 bytes was somewhat urban myth (at least as it applies to xAP).
T=
he
data packet size is not what=92s important; it=92s how the particular
IP stack implementation deals with &gt;datagrams&lt; that=92s the
key.
=A0</span></p>

</div>

</div>

</blockquote>

<div>

<p><br>
I don&#39;t understand what you are syaing here? The data packet size
is
inextricably linked to the IP stack. What aspect is it that you consider
to=
be
an urban myth?<br>
=A0</p>

</div>

<blockquote style=3D"border-style: none none none solid;
border-color: -moz=
-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204,
204);=
border-width: medium medium medium 1pt; padding: 0cm; margin-top: 5pt; mar=
gin-bottom: 5pt;">


<div>

<div>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">I only have ex=
perience of the
two most recent Windows stacks (XP and Vista) which I agree are likely more
capable than old embedded stacks. My experiments with Wireshark show that
t=
hose
stacks will happily deal with fragmentation and defragmentation. 64KB in a
single datagram? No problem if your receive buffer is long enough (even if
=
you
force a small MTU).</span></p>

</div>

</div>

</blockquote>

<div>

<p>Yes, agreed, OSes perform fragmentation for you. The
individual fragments have a maximum size as determined by the MTU. For
pragmatic, practical reasons, xAP needs to define a maximum overall message
size, and for convenience&#39;s sake that was set as equal to the
&#39;stan=
dard&#39; MTU
size. Devices which use a smaller MTU <i>should </i>fragment
and reassemble
seamlessly provided that the correct socket options have been set to
define=
the
maximum UDP packet size. By electing to use a single MTU&#39;s worth of
dat=
a, we we
avoid the overhead associated with fragmentation and reassembly
(principall=
y
memory buffering) which is a good thing. When reassembled, the os should
deliver a datagram as a complete entity in one go (irrespective of the mtu
size, assuming that the datagram falls within the maximum datagram size
def=
ined
for the stack). If the sender doesn&#39;t send a message as a single
datagr=
am, then
the whole thing falls apart because effectively you are then doing
fragmentation and reassembly at the application layer, and that
won&#39;t w=
ork
because the ordering across datagrams is not guaranteed and individual
datagrams may get lost.<br>
=A0</p>

</div>

<blockquote style=3D"border-style: none none none solid;
border-color: -moz=
-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204,
204);=
border-width: medium medium medium 1pt; padding: 0cm; margin-top: 5pt; mar=
gin-bottom: 5pt;">


<div>

<div>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">If anything go=
es wrong (eg,
missing fragment) the whole datagram is dropped. I can=92t see how packet
re-ordering can happen on a single LAN for broadcast UDP =96 there are no
multiple paths and no retry mechanism. Certainly never observed it =96 I
assume the stack would again just drop the entire
datagram.</span></p>

</div>

</div>

</blockquote>

<div>

<p style=3D"margin-bottom: 12pt;"><br>
Re-ordering of datagrams can occur for multiple reasons on a single lan. A
sender may send individual UDP packets in any order it chooses. This
common=
ly
occurs with fragmented packets originating from a multi-threaded sender,
wh=
ich
can be interleaved with smaller, non-fragmented datagrams as required
(optimising transient memory use, as soon as they are sent, the buffer can
=
be
released). A switch is not obliged to retransmit packets in the order in
wh=
ich
they are received. And most fundamentally, the specs do not require UDP
pac=
kets
to be ordered so, even if you don&#39;t observe it, it
<i>can</i> happen, a=
nd
sooner or later interoperability issues will arise if the working
assumptio=
n is
made that they always arrive in order.</p>

</div>

<blockquote style=3D"border-style: none none none solid;
border-color: -moz=
-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204,
204);=
border-width: medium medium medium 1pt; padding: 0cm; margin-top: 5pt; mar=
gin-bottom: 5pt;">


<div>

<div>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">A bigger issue=
for me, and the
reason for me experimenting a few times with TCP stream serving from hubs,
=
is
datagram loss over WiFi networks. This is greatly accentuated for UDP when
=
you
use broadcast (as we do) from wired to wireless (fine the other way as
it=92s not really a broadcast packet till it gets to the AP) as the access
point and NIC can not longer apply their ack/nak procedure at the transport
level. I commonly see xAP datagram loss rates from wired to wireless
connections of 20%. So I=92d like us to agree on a standard transport
wrapper for TCP streams which a lot of platforms would find
useful.</span><=
/p>

<p><span style=3D"font-size: 11pt; color: rgb(31, 73,
125);">=A0</span></p>

</div>

</div>

</blockquote>

<div>

<p>I&#39;d suggest using the same framing as the
&quot;transport
wrapper&quot;, as this then allows for code to be shared across
transports.=
If
xAP was extended to support TCP, then that should also include a formal
discovery mechanism by which the IP address/characteristics of the hub can
=
be
discovered (over UDP xAP?)<br>
<br>
Patrick<br>
=A0</p>

</div>

<blockquote style=3D"border-style: none none none solid;
border-color: -moz=
-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204,
204);=
border-width: medium medium medium 1pt; padding: 0cm; margin-top: 5pt; mar=
gin-bottom: 5pt;">


<div>

<div>

<div style=3D"border-style: none none none solid; border-color:
-moz-use-te=
xt-color -moz-use-text-color -moz-use-text-color windowtext; border-width:
=
medium medium medium 1.5pt; padding: 0cm;">

<div>

<div style=3D"border-style: solid none none; border-color:
windowtext -moz-=
use-text-color -moz-use-text-color; border-width: 1pt medium medium;
paddin=
g: 0cm;">

<p><b><span style=3D"font-size: 10pt;"
lang=3D"EN-US">From:</span></b><span=
style=3D"font-size: 10pt;" lang=3D"EN-US"> <a
href=3D"mailto:xAP_developer=
@yahoogroups.com"
target=3D"_blank">xAP_developer@xxxxxxx</a>
[mailto:<a href=3D"mailto:xAP_developer@xxxxxxx";
target=3D"_blank">=
xAP_developer@xxxxxxx</a>]
<b>On Behalf Of </b>Patrick Lidstone<br>
<b>Sent:</b> 14 September 2009 14:19<br>
<b>To:</b> <a href=3D"mailto:xAP_developer@xxxxxxx";
target=3D"_blan=
k">xAP_developer@xxxxxxx</a><br>
<b>Subject:</b> Re: [xAP_developer] xAP EOM identifier in xAP
v1.3</span></=
p>

</div>

</div>

<div>

<div>

<p>=A0</p>

<p>=A0 </p>

<div>

<div>

<div>

<p>So the xAP delimiters for serial are defined in the 1.2 xAP spec
here:<b=
r>
<a href=3D"http://www.xapautomation.org/index.php?title=3DProtocol_definiti=
on#Transport_Wrapper" target=3D"_blank">http://www.xapautomation.org/index.=
php?title=3DProtocol_definition#Transport_Wrapper</a><br>
<br>
To the best of my knowledge, the MTU size for an ethernet frame is 1518
byt=
es,
which leads to a UDP packet MTU of 1500 bytes and this is the size that is
adopted by the majority of operating systems. Internet routers (i.e. ISPs)
sometimes use an MTU of 576 bytes, but this wouldn&#39;t be relevant to
xAP=
since
the traffic doesn&#39;t pass over the wider net, or if it does,
it&#39;s ge=
nerally
gatewayed via a TCP/IP connection.<br>
<br>
If a device is receiving fragmented UDP packets, I think the same issues
ar=
ise
as those related to extending the xAP message size beyond 1500 bytes - what
happens if a fragment gets discarded.<br>
<br>
If you take the scenario:<br>
<br>
Part 1(a), Part 1(b), Part 2(a), Part 2(b), Part 3(a), Part 3(b)<br>
<br>
--- first there is no guarantee that the parts will be delivered in order,
=
and
second, if part 1(b) was dropped, and you were blindly assembling messages
based on the proposed double-0a terminator, you&#39;d end up with a
message
comprising part 1(a), 2(a) and 2(b) which is not only obviously corrupt,
bu=
t
also possibly larger than the maximum xAP message size, blowing away your
buffers.<br>
<br>
I think the solution is to probably parse incoming messages on the fly,
byte-by-byte. You can then at least reset your state when you encounter the
xap-header, and if you count open and close curly braces, you can tell
when=
you
have an apparently complete message. This won&#39;t solve the issue of
UDP
fragments being potentially received out of order, but so long as we are
dealing with a single LAN, and fragmentation occurs at the receiver, we
wil=
l be
ok I think.<br>
<br>
It is absolutely possible for UDP packets to be discarded, and the way we
d=
eal
with this in xAP is to accept that this can happen to xAP messages, and
lay=
er
application level acknowledgements where knowing that a message has been
received is critically important - whether explicitly or implicitly through
status messages. There are various schemes that could be adopted to allow a
receiver to detect lost messages (e.g. sequence numbering), but they
quickl=
y
become quite onerous, and assume that the originator keeps a copy of the
original message or is able to reconstruct it - which is non-trivial for
th=
e
many xAP nodes.<br>
<br>
Perhaps you can share more of the specific details of the device(s) in
ques=
tion
(manufacturer, docs, o/s etc), and their specific behaviour, which seems a
=
bit
anomalous?<br>
<br>
Patrick</p>

<div>

<p>2009/9/13 Kevin Hawkins &lt;<a href=3D"mailto:yahoogroupskh@xxxxxxx=
om"
target=3D"_blank">yahoogroupskh@xxxxxxx</a>&gt;</p>

<p>One of the issues seems to be that there is conflicting views as
to the<=
br>
length of a a UDP data packet payload. =A0Some people cite 500 or
512<br>
characters and some 1500. =A0Regardless in some low
memory/performance<br>
devices it is being reported, that even with UDP, =A0packets are
being<br>
received from the buffer either truncated or appended back to
back.<br>
The latter I assume is due to the speed of the device in servicing
the<br>
buffer.<br>
<br>
We have an opportunity to protect against this with v1.3 and the
double<br>
&#39;0A&#39; seems the most compatible. =A0 I would be loathe to
support an=
ything<br>
that wasn&#39;t backward compatible.<br>
<br>
=A0 K</p>

<div>

<p><br>
Patrick Lidstone wrote:<br>
&gt;<br>
&gt;<br>
&gt; I will dig it out - it included an optional checksum I think, and
IIRC=
<br>
&gt; was framed by stx and etx (a kind of pseudo industry standard).
I<br>
&gt; certainly used it with the PIC serial stuff and the xAP-serial
bridge.=
<br>
&gt; Re.: long message truncation and concatenation: If we need to
support<=
br>
&gt; messages that are larger than one UDP packet, then there
are<br>
&gt; additional complexities and the proposed scheme won&#39;t work
as inte=
nded<br>
&gt; as the ordering of UDP messages is not guaranteed. I&#39;m
happy to he=
lp<br>
&gt; refine a spec to support these capabilities, but it is moving
away<br>
&gt; from the basic ethos of xAP somewhat, as devices would have to be
able=
<br>
&gt; to buffer received messages, and that raises the bar
considerably.<br>
&gt; Perhaps there is scope for co-existence of a long and standard
message=
<br>
&gt; protocol though?<br>
&gt;<br>
&gt; Patrick<br>
&gt;<br>
&gt; 2009/9/13 Kevin Hawkins &lt;<a href=3D"mailto:yahoogroupskh@googlemail=
.com"
target=3D"_blank">yahoogroupskh@xxxxxxx</a></p>

</div>

<p>&gt; &lt;mailto:<a href=3D"mailto:yahoogroupskh@xxxxxxx";
target=
=3D"_blank">yahoogroupskh@xxxxxxx</a>&gt;&gt;</p>

<div>

<p>&gt;<br>
&gt; =A0 =A0 ... Oh ... where is that in the spec ? =A0it might be all
we need.<br>
&gt;<br>
&gt; =A0 =A0 =A0 =A0This is also tied in with some aspects of long
message truncation<br>
&gt; =A0 =A0 and concatenation of messages received in UDP receive
buffers<br>
&gt; =A0 =A0 though...<br>
&gt;<br>
&gt; =A0 =A0 =A0K<br>
&gt;<br>
&gt; =A0 =A0 Patrick Lidstone wrote:<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; The original xap spec provides extensions for
framing a
message over<br>
&gt; =A0 =A0 &gt; async serial which also delimit the start of the
message - you don&#39;t<br>
&gt; =A0 =A0 &gt; need this &#39;hack&#39; if you follow
the original spec =
for
non-UDP<br>
&gt; =A0 =A0 transports.<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; Patrick<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; 2009/9/13 Kevin Hawkins &lt;<a
href=3D"mailto:yahoogroups=
kh@xxxxxxx"
target=3D"_blank">yahoogroupskh@xxxxxxx</a><br>
&gt; =A0 =A0 &lt;mailto:<a href=3D"mailto:yahoogroupskh@xxxxxxx";
tar=
get=3D"_blank">yahoogroupskh@xxxxxxx</a>&gt;</p>

</div>

<p>&gt; =A0 =A0 &gt; &lt;mailto:<a href=3D"mailto:yahoogroupskh@googlemail.=
com"
target=3D"_blank">yahoogroupskh@xxxxxxx</a></p>

<div>

<div>

<p>&gt; =A0 =A0 &lt;mailto:<a href=3D"mailto:yahoogroupskh@xxxxxxx";
=
target=3D"_blank">yahoogroupskh@xxxxxxx</a>&gt;&gt;&gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 =A0 We have been asked on several
occasions how to detect the<br>
&gt; =A0 =A0 end of a<br>
&gt; =A0 =A0 &gt; =A0 =A0 xAP messager as there is no unique EOM
character. =A0Typically<br>
&gt; =A0 =A0 in any<br>
&gt; =A0 =A0 &gt; =A0 =A0 reasonable sized packet structured
transport eg UDP then the<br>
&gt; =A0 =A0 packet<br>
&gt; =A0 =A0 &gt; =A0 =A0 provides such an indication but on
systems with small packets or<br>
&gt; =A0 =A0 &gt; =A0 =A0 non eg<br>
&gt; =A0 =A0 &gt; =A0 =A0 asynchronous serial this is not
useable.<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 =A0 In discussing this with the
specification team we must<br>
&gt; =A0 =A0 consider<br>
&gt; =A0 =A0 &gt; =A0 =A0 backwards compatability and so we do not
wish to alter the<br>
&gt; =A0 =A0 &gt; =A0 =A0 specification<br>
&gt; =A0 =A0 &gt; =A0 =A0 to include a unique EOM character.
=A0What we do propose<br>
&gt; =A0 =A0 however is that<br>
&gt; =A0 =A0 &gt; =A0 =A0 xAP v1.3 will specify that all messages
should end with two<br>
&gt; =A0 =A0 &gt; =A0 =A0 consecutive<br>
&gt; =A0 =A0 &gt; =A0 =A0 chr(10)&#39;s immediately after the
closing
&#39;}&#39;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 ie =A0..... 7D 0A 0A<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 =A0Some apps, even v1.2 ones,
=A0already do this. =A0We don&#39;t<br>
&gt; =A0 =A0 believe this<br>
&gt; =A0 =A0 &gt; =A0 =A0 will cause any backwards compatibility
issues and it will<br>
&gt; =A0 =A0 always be<br>
&gt; =A0 =A0 &gt; =A0 =A0 unique within a xAP message.<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 =A0So, in developing xAP v1.3 apps
could you therefore append<br>
&gt; =A0 =A0 =A0two 0A&#39;s<br>
&gt; =A0 =A0 &gt; =A0 =A0 at the end of your messages , and of
course handle incoming<br>
&gt; =A0 =A0 messages<br>
&gt; =A0 =A0 &gt; =A0 =A0 containing such.<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 =A0 K<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0
------------------------------------<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 Yahoo! Groups Links<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 =A0 =A0mailto:<a href=3D"mailto:xAP_developer-ful=
lfeatured@xxxxxxx"
target=3D"_blank">xAP_developer-fullfeatured@yah=
oogroups.com</a><br>
&gt; =A0 =A0 &lt;mailto:<a href=3D"mailto:xAP_developer-fullfeatured@yahoog=
roups.com"
target=3D"_blank">xAP_developer-fullfeatured@xxxxxxx</a>=
&gt;<br>
&gt; =A0 =A0 &gt; =A0 =A0 &lt;mailto:<a href=3D"mailto:xAP_developer-fullfe=
atured@xxxxxxx"
target=3D"_blank">xAP_developer-fullfeatured@yahoog=
roups.com</a><br>
&gt; =A0 =A0 &lt;mailto:<a href=3D"mailto:xAP_developer-fullfeatured@yahoog=
roups.com"
target=3D"_blank">xAP_developer-fullfeatured@xxxxxxx</a>=
&gt;&gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt; =A0 =A0 &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; =A0 =A0 ------------------------------------<br>
&gt;<br>
&gt; =A0 =A0 Yahoo! Groups Links<br>
&gt;<br>
&gt;<br>
&gt; =A0 =A0 =A0 =A0mailto:<a href=3D"mailto:xAP_developer-fullfeatured@yah=
oogroups.com"
target=3D"_blank">xAP_developer-fullfeatured@xxxxxxx<=
/a><br>
&gt; =A0 =A0 &lt;mailto:<a href=3D"mailto:xAP_developer-fullfeatured@yahoog=
roups.com"
target=3D"_blank">xAP_developer-fullfeatured@xxxxxxx</a>=
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
------------------------------------<br>
<br>

xAP_Development Main Index | xAP_Development Thread Index | xAP_Development Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.