<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jun 5, 2011, at 3:35 PM, Martin v. Löwis wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Bitstream Vera Sans Mono'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">And that's all fine. I still claim that you have to *understand*<br>sockets in order to use it properly. By this, I mean stuff like<br>"what is a TCP connection? how is it established?", "how is UDP<br>different from TCP?", "when data arrives, what layers of software<br>does it go through?", "what is a port number?", etc.<br></span></span></blockquote></div><br><div><div>Yes, these are all excellent concepts to be familiar with. &nbsp;But the word "socket" (and the socket HOWTO) refers to a specific way to interface with those concepts, the Berkeley socket API: &lt;<a href="http://en.wikipedia.org/wiki/Berkeley_sockets">http://en.wikipedia.org/wiki/Berkeley_sockets</a>&gt;. &nbsp;Which you don't have to know anything about if you're going to use Twisted. &nbsp;You should know about IPC in general, and TCP/UDP specifically if you're going to use Twisted, but sockets are completely optional.</div><div><br></div><div>Also, I feel that I should point out that the sockets HOWTO does not cover even a single one of these concepts in any useful depth. &nbsp;If you think that these are what it should be explaining, it needs some heavy editing. &nbsp;Here's what it has to say about each one:</div></div><div><br></div><div><blockquote type="cite"><span class="Apple-style-span" style="font-family: monospace; ">what is a TCP connection?</span></blockquote><br></div><div>The only place that the characters "TCP" appear in the entire document is in the phrase "...&nbsp;which is completely different from&nbsp;TCP_NODELAY ...". &nbsp;Nowhere is a TCP connection explained at a conceptual level, except to say that it's something a web browser does.</div><div><br></div><div><blockquote type="cite"><span class="Apple-style-span" style="font-family: monospace; ">how is UDP&nbsp;</span><span class="Apple-style-span" style="font-family: monospace; ">different from TCP?</span></blockquote><br></div><div>The phrase "UDP" never appears in the HOWTO. &nbsp;DGRAM sockets get a brief mention as "anything else" in the sentence: "... you’ll get better behavior and performance from a STREAM socket than anything else ...". &nbsp;(To be fair, I do endorse teaching that "the difference between TCP and UDP is that you should not use UDP" to anyone not sufficiently advanced to read the relevant reference documentation themselves.)</div><div><br></div><div><blockquote type="cite"><span class="Apple-style-span" style="font-family: monospace; ">when data arrives, what layers of software&nbsp;</span><span class="Apple-style-span" style="font-family: monospace; ">does it go through?</span></blockquote><br></div><div>There's no discussion of this that I can find at all.</div><div><br></div><div><blockquote type="cite"><span class="Apple-style-span" style="font-family: monospace; ">what is a port number?</span></blockquote><br></div><div>Aside from a few comments in the code examples, the only discussion of port numbers is "low number ports are usually reserved for “well known” services (HTTP,&nbsp;SNMP etc)."</div><div><br></div><div>It would be very good to have a "Python networking overview" somewhere that explained this stuff at a very high level, and described how data might get into or out of your program, with links to things like the socket HOWTO that describe more specific techniques. &nbsp;This would be useful because most commonly, I think that data will get into Python network programs via WSGI, not direct sockets or anything like Twisted.</div><div><br></div><div>To be clear, having read it now: I do _not_ agree with Antoine that this document should be deleted. &nbsp;I dimly recall that it helped me understand some things in the very early days of Twisted. &nbsp;While it's far from perfect, it might help someone in a similar situation understand those things as well today. &nbsp;I just found it interesting that the main concepts one would associate with such a HOWTO are nowhere to be found :).</div><div><br></div><div>-glyph</div></body></html>