<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi Miika,</div><br><div><div>On May 4, 2013, at 8:54 AM, Miika Komu &lt;<a href="mailto:mkomu@cs.hut.fi">mkomu@cs.hut.fi</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">with connected sockets, (almost) the same API calls could be used and<span class="Apple-converted-space">&nbsp;</span></span><br style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">the details could be possibly abstracted away (some kind of a flag still<span class="Apple-converted-space">&nbsp;</span></span><br style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">needed to choose between TCP and UDP). A number of applications appear<span class="Apple-converted-space">&nbsp;</span></span><br style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">to support both TCP and UDP-based connectivity:</span><br style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote><div><br></div><div>Supporting both TCP (stream-based) and UDP (datagram-based) communications requires explicit decisions on the part of the application, both in the design of the protocol and in the logic of its parsing. &nbsp;The biggest difference is that TCP applications must implement logic to deal with framing, where as UDP applications do not need to, but there are other nuances as well.</div><div><br></div><div>See this frequently asked question for more information:</div><div><br></div><div>&lt;<a href="http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#Whyisprotocol.dataReceivedcalledwithonlypartofthedataIcalledtransport.writewith">http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#Whyisprotocol.dataReceivedcalledwithonlypartofthedataIcalledtransport.writewith</a>&gt;</div><br><blockquote type="cite"><span style="font-family: Monaco;">While&nbsp;</span><span style="font-family: Monaco;">it is possible to write almost identical code for the two transports,&nbsp;</span></blockquote><blockquote type="cite"><span style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">the Sockets API favors different functions for the two. This<span class="Apple-converted-space">&nbsp;</span></span><br style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">unnecessarily complicates the application code.</span><br style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote></div><br><div>It does not "unnecessarily complicate" the application code; it introduces a different code path for a semantically distinct operation (transmit a datagram vs. transmit a stream segment).</div><div><br></div><div>Based on my experience helping people understand UDP in the past, I would hazard a guess that many of these application protocols that can run in hybrid TCP/UDP mode are simply full of bugs because their developers did UDP testing on a fast local network, where, under low load, UDP can superficially behave like TCP and did not appreciate the semantics of the low-level networking operations they were invoking. &nbsp;Twisted at least makes the distinction explicit, so that in order to make this mistake you need to consciously implement the same code against two transports.</div><div><br></div><div>Thanks for looking into Twisted, though; the fact that we have already addressed most of your other criticisms in our development process indicates that most of the other issues you pointed out were spot on :). &nbsp;I just hope that next time you'll have a look at a more recent version!</div><div><br></div><div>-glyph</div><div><br></div></body></html>