Working with TCP

The good news about TCP, and other low-level network protocols, is that even when we’re writing low-level application code, we generally don’t need to implement them ourselves. Instead, our OS provides an implementation, and exposes it to us in the form of system calls and their accompanying C library functions. Although we’ve used syscalls a few times already, this is a good time to discuss some of the technical details.

System Calls and Blocking I/O

When our code invokes a syscall, it hands over execution to the operating system. While the OS is working, it executes its own code, in its own private memory address space, until it has a result to return. Some system calls return almost instantly, although there’s still an overhead ...

Get Modern Systems Programming with Scala Native now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.