in reply to Server sends knock-knock, client does something.

Anything that listens for something to happen is usually called a "server", at least when you're talking sockets. So, just reverse the roles of "server" and "client", and that's it, at least if you want to stay connectionless.

As an alternative approach, you can simply connect with your client to the server and then read commands from the socket. Very little CPU will be wasted while waiting for data to arrive.

  • Comment on Re: Server sends knock-knock, client does something.