Tag: #tcp
How to write a TCP server with the
pthread
API A TCP server that uses
pthread
to serve multiple clients concurrently, with an “echo” server for each connection. 2017-02-28How to write a TCP server using the
fork
syscall A TCP server that uses the
fork
system call to create a new child process for each accepted connection, allowing it to handle multiple clients concurrently. 2017-02-25What are ‘protocol numbers’ in IP?
An IP packet contains a ‘protocol number’ that identifies the protocol (e.g. TCP, UDP) running over IP. The kernel uses this to determine how to handle the packet. 2016-12-23
How to write a TCP server with the
kqueue
API Kqueue is a more efficient alternative to
select
for managing multiple TCP connections, providing a publish-subscribe model for tracking events in the kernel. 2016-12-18How to write a TCP server with the
select
syscall The
select
syscall allows a process to sleep and wake up when a file descriptor is ready for reading, writing, or has an exceptional condition. This enables a TCP server to handle multiple clients concurrently. 2016-12-16What syscalls does a TCP server need?
A minimal TCP server in C uses the
socket
, bind
, listen
, accept
, recv
, send
, and close
syscalls to manage connections. 2016-12-14All content copyright James Fisher.