Posts on rottenbloghttps://blog.rottenwheel.com/posts/Recent content in Posts on rottenblogHugoen-usFri, 28 Jan 2022 03:00:00 +0300Example posthttps://blog.rottenwheel.com/posts/post-1/Fri, 28 Jan 2022 03:00:00 +0300https://blog.rottenwheel.com/posts/post-1/<p>What you need to do is:</p> <ol> <li>Create the sockets.</li> <li>Add the sockets to the set (<code>FD_SET</code>).</li> <li>Find the socket with the highest file descriptor for calls to select().</li> </ol> <p>Above also works with different type sockets (e.g. <code>AF_INET</code>, <code>AF_INET6</code>). It even works if you have different type sockets (e.g. one IPv4 and one IPv6) listening on the same port number. Dual stack sockets are a thing but this approach is more flexible.</p>