Once upon a time, there was a university president who couldn’t send an email more than 500 miles, and the wise sysadmin said that’s not possible, so the president said come to my office, and lo and behold, the emails stopped before going 500 miles. Has technology improved? Can we send an email farther than 500 miles in 2025?
There’s a lot to the story that’s obviously made up, but if we fix the details so that it can happen, we can reproduce it.
connect
We need some code to do a nonblocking connect that will timeout quickly. This is mostly copied from the examples in getaddrinfo for lookups and connect, and connect for the nonblocking check, adapted slightly to have a very short timeout and report errors.
The poll timeout is 3ms, as specified by the lore. I think this is nonsense, why would an invalid or incomplete sendmail configuration default to three milliseconds? But that’s the time you get backing a lightspeed delay out of 500 miles. We’ll see if it matters.
code #include
"); freeaddrinfo(res0); }
The secret here is the kernel will always round 3ms up to at least one whole tick, 10ms. And maybe we get a bit extra from the current tick. So the actual timeout will be 10ms to 19ms. Enough time to make a quick roundtrip even at half c. poll or select with a zero timeout returns immediately, so not much chance of finishing the connection before that happens.
We’re not going to try sending an email with sendmail because I don’t want to wait three days while the message sits in the retry queue before failing. I hope they had some sandwiches delivered to the president’s office while the demonstration was in progress.
success
... continue reading