Free course
Socket Programming with Node.js
Build TCP and UDP programs with Node.js, frame messages, handle unreliable connections, and design a small protocol you can inspect on the wire.
Prerequisites: JavaScript, Node.js and Networking Foundations
Download this course as PDF or EPUB
Read it offline, on your Kindle, or print it. Join my free newsletter and you get this course plus every other book and course I published.
Download this course as PDF or EPUB
Read it offline, on your Kindle, or print it.
Your progress
of lessons completed.
Course completed.
What you'll learn
Build and test TCP and UDP clients and servers that frame input, apply limits, handle failures, and support multiple clients safely.
Course contents
TCP foundations
Build a TCP server and client, exchange bytes, and control the listening address.
Message framing
Build a newline protocol, buffer partial input, parse JSON messages, and enforce size limits.
Connection reliability
Handle timeouts, half-closes, resets, backpressure, and cleanup without leaking resources.
UDP datagrams
Build UDP endpoints, preserve message boundaries, and add retries, identifiers, and duplicate handling.
Build and test a protocol
Specify commands, validate limits, support concurrent clients, inspect packets, and finish a small service.