More Information About "Working With TCP Sockets"
Published on June 12, 2012 by Jesse Storimer
Recently I annoucned that I'm working on a new book. This one's all about socket programming with Ruby. The website has some information about what the book covers. You can subscribe to the email list to stay updated and get a deal when it's launched.
Why write this book?
There was a time when learning the fundamentals of socket programming was par for the course in a programmer's development. In fact, learning the fundamentals of pretty much everything was par for the course. There weren't enough abstractions in place to hide the 'metal'.
Over time more and more abstractions were layered on top of the metal. Abstractions are good, they make our lives easier. The abstractions I'm talking about were implemented by these people that saw the metal and understood the fundamentals.
Fast forward to the last decade. In the last ten years there's been an explosion of people who are brand new to programming. Thanks to the web.
By the time these folks got into the game there were enough abstractions in place that they didn't have to understand the fundamentals in order to write code.
These fortunate folks got to pick up tools like PHP or Ruby on Rails, they used these to build web applications and networked services without having to understand the first thing about networking. Many of these people are fine programmers but still don't understand the fundamentals. It wasn't long ago that I was one of them.
I think that learning fundamentals is important. I think it makes you better at what you do. It gives you a deeper understanding and appreciation for the work you do every day. The truth is: the people who skipped over the fundamentals in order to get busy won't be the ones inventing the next generation tools, they simply don't have the know-how.
There's a lot of great books out there that explain socket programming, but none of them are written for you. You're a web developer, one who writes Ruby code. You can find socket programming books out there written for system administrators, kernel hackers, and the like, but not for web developers. This book will fill that gap.
It's only by coincidence that this is a book about socket programming in Ruby. At the core it's about socket programming concepts. It uses Ruby to explain and demonstrate these concepts because that's what we're familiar with. Ruby exposes all of the same primitives that are available in other languages. So you'll learn the concepts using Ruby, then take them with you when you use Java, node.js, C, anywhere.
This book will give you a firm grip on the fundamental concepts of socket programming. This means that once you've worked through it you'll be able to understand how sockets are being utilized in your stack (in your web server, for example) and you'll understand how to write software that leverages sockets (clients, servers, even libraries like EventMachine).
What will be covered?
The book is still a work-in-progress, so now's the time to give your input if you want to learn about specific topics.
There are some things that I know will be included, they're already in progress:
- Basics of addressing
- Composing servers using low-level primitives
- Using Ruby's Socket class and friends (TCPSocket, TCPServer, etc) Ruby offers above the primitives
- Different methods of reading/writing data
- The why and how of doing nonblocking IO
- Audits of real world projects
- Framing messages and the stream-based nature of TCP
- Efficient timeouts for sockets
- Multiplexing connections with IO.select
This list is not yet complete so now's your chance to be heard. What do you want to know about? What questions do you want answered? Send me a message at email@example.com with any questions or comments, I'd love to hear from you.
That's all I have to share about the book right now, if you're interested in staying updated then you should sign up for the email list.