I did a bit of experiments with netsync-ing and I think how it should be done:
Coldsync listening to UDP packets should be a separate server.
What it does just listens to incoming packets and sends ACKs, nothing else ( it can check if TCP listener is running, in this case it can send NACK).
Don't have to be multithreaded - UDP packets are easy to handle.
Another server would be TCP listener,
There are three possible options how to make it:
1) to start from inetd.conf
2) have standalone parent server which spawns a child every time there is incoming connection ( like Apache )
3) have true multithreaded POSIX-style server
What is the best ? Any opinions ?