Suppose I want a chargen like server, so I invoke
while sleep 1; do date; done | ncat -kl 12345
If no one is reading the pipe, then the first client to connect to the socket will immediately get a bunch of output all at once. To prevent that, I could certainly have a daemon make a connection to the socket to drain the pipe, but that seems inelegant. ncat 5.00 does not appear to have an option to discard input if no connections are currently active. Is there a clean way to prevent the first client to connect from getting backlogged data?