
Ask HN: Books on network programming patterns? - mgmeyers
Hello, HN!<p>I&#x27;ve recently been getting deeper into node.js for things other than your typical web app, and have encountered a topic I&#x27;m not familiar with: network programming. I am completely ignorant on the topic and seek some guidance.<p>Can anyone recommend any high-level books (or other resources) on network programming? For example, something that covers patterns like PUB&#x2F;SUB, REQ&#x2F;RES, Router&#x2F;Dealer, etc.<p>Thanks in advanced!
======
astigsen
The classics for learning about network programming is the TCP/IP Illustrated
series by W. Richard Stevens:

TCP/IP Illustrated, Volume 1: The Protocols [http://www.amazon.com/TCP-
Illustrated-Volume-Addison-Wesley-...](http://www.amazon.com/TCP-Illustrated-
Volume-Addison-Wesley-Professional/dp/0321336313)

TCP/IP Illustrated, Volume 2: The Implementation [http://www.amazon.com/TCP-
IP-Illustrated-Implementation-Vol/...](http://www.amazon.com/TCP-IP-
Illustrated-Implementation-Vol/dp/020163354X)

TCP/IP Illustrated, Volume 3: TCP for Transactions, HTTP, NNTP, and the UNIX
Domain Protocols [http://www.amazon.com/TCP-Illustrated-Vol-Transactions-
Proto...](http://www.amazon.com/TCP-Illustrated-Vol-Transactions-
Protocols/dp/0201634953)

While they start at much lower level than generic patterns, they build the
basis to understand the core of networking, and the the later books go into
details about effective usage of the protocols.

~~~
adamnemecek
The issue with those books is that even if you have read them, you might still
have a hard time writing networking code as they don't talk about the patterns
which is what I think OP wants to learn.

------
jvoorhis
Since your example patterns seem to be informed by ZeroMQ, I recommend
checking out the online 'zguide' book at
[http://zguide.zeromq.org/page:all](http://zguide.zeromq.org/page:all).

------
angersock
If you are learning about networking, and not just using somebody else's
library, Beej's guide is an excellent starting point:

[http://beej.us/guide/bgnet/](http://beej.us/guide/bgnet/)

------
adamnemecek
You might find the books "C++ Network Programming, Volume I: Mastering
Complexity with ACE and Patterns"[0] and "C++ Network Programming, Volume 2:
Systematic Reuse with ACE and Frameworks"[1] useful. They talk about
implementation of the "Adaptive Communication Environment" [2] which is an
open-source project for network programming. Also, as nextos mentioned below,
the "Pattern-Oriented Software Architecture" series.

[0] [http://www.amazon.com/Network-Programming-Volume-
Mastering-C...](http://www.amazon.com/Network-Programming-Volume-Mastering-
Complexity/dp/0201604647/)

[1] [http://www.amazon.com/Network-Programming-Volume-
Systematic-...](http://www.amazon.com/Network-Programming-Volume-Systematic-
Frameworks/dp/0201795256)

[2]
[http://en.wikipedia.org/wiki/Adaptive_Communication_Environm...](http://en.wikipedia.org/wiki/Adaptive_Communication_Environment)

------
MartinMond
Just Open a Socket - Connecting Applications to Distributed Systems is a great
talk to watch:

[https://www.youtube.com/watch?v=jytJXjI0oQU](https://www.youtube.com/watch?v=jytJXjI0oQU)
[https://speakerdeck.com/seancribbs/just-open-a-socket-
connec...](https://speakerdeck.com/seancribbs/just-open-a-socket-connecting-
applications-to-distributed-systems)

Other talks from ricon.io and the various Erlang conferences are great too,
but those are more about distributed systems and not primarily network
programming. But since you mentioned the ZeroMQ patterns that should be just
what you want.

[http://thinkdistributed.io/](http://thinkdistributed.io/)
[http://ricon.io/](http://ricon.io/)
[https://www.youtube.com/user/ErlangSolutions/videos](https://www.youtube.com/user/ErlangSolutions/videos)

------
keithba
Enterprise Integration Patterns:

[http://www.amazon.com/Enterprise-Integration-Patterns-
Design...](http://www.amazon.com/Enterprise-Integration-Patterns-Designing-
Deploying/dp/0321200683/ref=pd_bxgy_b_text_y)

[http://www.eaipatterns.com/](http://www.eaipatterns.com/)

Covers stuff like: RPC, messages, channels, etc.

------
nextos
Check out the Pattern-Oriented Software Architecture volumes.

You can also draw a lot of inspiration from the Erlang literature, and CTM.

------
spikyobjects
Not directly answering your question, but: ZeroMQ is a network programming
library that uses and encourages the use of "patterns". Take a look at the
(excellent) ZeroMQ manual.

