Increasing limit of FD_SETSIZE and select

Per the standards, there is no way to increase FD_SETSIZE. Some programs and libraries (libevent comes to mind) try to work around this by allocating additional space for the fd_set object and passing values larger than FD_SETSIZE to the FD_* macros, but this is a very bad idea since robust implementations may perform bounds-checking on … Read more

Sending file descriptor by Linux socket

Stevens (et al) UNIX® Network Programming, Vol 1: The Sockets Networking API describes the process of transferring file descriptors between processes in Chapter 15 Unix Domain Protocols and specifically §15.7 Passing Descriptors. It’s fiddly to describe in full, but it must be done on a Unix domain socket (AF_UNIX or AF_LOCAL), and the sender process … Read more

What is the theoretical maximum number of open TCP connections that a modern Linux box can have

A single listening port can accept more than one connection simultaneously. There is a ’64K’ limit that is often cited, but that is per client per server port, and needs clarifying. Each TCP/IP packet has basically four fields for addressing. These are: source_ip source_port destination_ip destination_port <—– client ——> <——— server ————> Inside the TCP … Read more