Jan Newmarch and Ronald Petty
Network Programming with Go Language
Essential Skills for Programming, Using and Securing Networks with Open Source Google Golang
2nd ed.
Logo of the publisher
Dr. Jan Newmarch
Oakleigh, VIC, Australia
Ronald Petty
San Francisco, CA, USA
ISBN 978-1-4842-8094-2 e-ISBN 978-1-4842-8095-9
https://doi.org/10.1007/978-1-4842-8095-9
Jan Newmarch and Ronald Petty 2022
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress Media, LLC, part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY 10004, U.S.A.
I dedicate this to my family.
Preface to the Second Edition
While an age has passed in Internet years, Go remains a primary destination for programmers. Go conquered the container technology space. It continues to find affection in Cloud Native development. Go strives to remain true to itself, backward compatible, yet adding new language features like Generics. Tooling improvements such as Fuzzing allow for more secure application development.
Go has changed, and so has this book. The first edition used Go 1.8; we are now on Go 1.18. The code has been updated to reflect this new reality. The examples have been largely developed to show a particular feature of Go networking without forcing complexity like managing several projects or packages scattered across the book; the associated repository can be found here https://github.com/Apress/network-prog-with-go-2e .
The first version of this book assumed familiarity with Go, and that remains in this edition. We expand slightly what we are willing to discuss in this book with the inclusion of more third-party modules, tools, and techniques. Jan was correct to keep the focus on Go and not to be distracted with the ecosystem at large.
If you desire to learn about implementing networking concepts with Go, I hope this book serves you well.
As a point of comparison, what follows is Jans original preface, reflecting Go in 2017.
Preface to the First Edition
Its always fun to learn a new programming language, especially when it turns out to be a major one. Prior to the release of Go in 2009, I was teaching a Masters level subject in network programming at Monash University. Its good to have a goal when learning a new language, but this time, instead of building yet another wine cellar program, I decided to orient my lecture notes around Go instead of my (then) standard delivery vehicle of Java.
The experiment worked well: apart from the richness of the Java libraries that Go was yet to match, all the programming examples transferred remarkably well, and in many cases were more elegant than the original Java programs.
This book is the result. I have updated it as Go has evolved and as new technologies such as HTTP/2 have arisen. But if it reads like a textbook, well, that is because it is one. There is a large body of theoretical and practical concepts involved in network programming and this book covers some of these as well as the practicalities of building systems in Go.
In terms of language popularity, Go is clearly rising. It has climbed to 16th in the TIOBE index, is 18th in the PYPL (Popularity of Programming Language), and is 15th in the RedMonk Programming Language rankings. It is generally rated as one of the fastest growing languages.
There is a growing community of developers both of the core language and libraries and of the independent projects. I have tried to limit the scope of this book to the standard libraries only and to the sub-repositories of the Go tree. While this eliminates many excellent projects that no doubt make many programming tasks easier, restricting the book to the official Go libraries provides a clear bound.
This book assumes a basic knowledge of Go. The focus is on using Go to build network applications, not on the basics of the language. Network applications are different than command-line applications, are different than applications with a graphical user interface, and so on. So the first chapter discusses architectural aspects of network programs. The second chapter is an overview of the features of Go that we use in this book. The third chapter on sockets covers the Go version of the basics underlying all TCP/IP systems. Chapters consider further aspects of network programming using HTTP.
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub. For more detailed information, please visit https://github.com/Apress/network-prog-with-go-2e .
Acknowledgments
I want to share my appreciation for Jan Newmarch for collaborating on this book. This project has offered me a tremendous sense of achievement and allowed me to cross a much-anticipated item off my bucket list. I would also like to thank Eldon Alameda for his thoughtful approach at letting me know when I am off the mark and for providing me with solid advice.
Additionally, I owe gratitude to my partners at Apress, both Steve Anglin for the opportunity and Mark Powers for the guidance to help see this through. Thank you to my colleagues at RX-M, including Randy Abernethy, Christopher Hanson, Andrew Bassett, and Anita Wu. Our work over the years has allowed for my participation in a project such as this book.
Finally, I want to thank my wife Julie and daughter Charlotte. Julies capacity to manage the world while I hide out on a computer is unmatched and most appreciated. Charlottes energy, abilities, and creativity inspire me to become better every day.
Ronald Petty