TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Python socket programming tutorial

88 pointsby silv3r_m00nover 12 years ago

5 comments

peter_l_downsover 12 years ago
If you want to understand sockets, there's no excuse for not reading Beej's Guide to Network Programming [1]. It's C, not Python, but it covers all of the dirty details and explains <i>exactly</i> what's going on when you create a socket. For instance, this article never mentions that sockets are file descriptors — in Beej's article, it's right after the introduction (Section 2 [2]).<p>How does this article describe a socket?<p><pre><code> &#62; sockets are the fundamental "things" behind any kind of network communications done by your computer" </code></pre> Not very helpful.<p>[1] <a href="http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html" rel="nofollow">http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html</a><p>[2] <a href="http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#theory" rel="nofollow">http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html...</a>
评论 #4667238 未加载
rflrobover 12 years ago
Is there a reason to catch all those exceptions? If you're just sys.exit()ing anyways, why sacrifice all the traceback info?
评论 #4667405 未加载
djtriptychover 12 years ago
Decent tutorial, though I find the official Python HOWTO to be a more thorough and appropriate introduction to sockets for the complete newbie...<p><a href="http://docs.python.org/howto/sockets.html" rel="nofollow">http://docs.python.org/howto/sockets.html</a>
评论 #4665750 未加载
Myrmornisover 12 years ago
I really highly recommend "Foundations of Python Network Programming" by Brandon Rhodes and John Goerzen. It's just one of the best technical books I've read, from the opening example onwards. <a href="http://www.apress.com/9781430230038" rel="nofollow">http://www.apress.com/9781430230038</a>
评论 #4666251 未加载
njharmanover 12 years ago
Shouldn't the first step be install <a href="http://www.zeromq.org/" rel="nofollow">http://www.zeromq.org/</a>? That is some seriously amazing stuff right there. Makes network programming (something I've avoided for years) almost trivial.
评论 #4665351 未加载
评论 #4665195 未加载
评论 #4666775 未加载