Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Sorry all, I'm kind of new to network programming, and not entirely sure where to start on this one. Basically, just need someone to point me in the right direction.

I have a client daemon that does stuff on the client. As it is set up now, it does what it needs to do on a timed interval (every 30 minutes). However, I'd very much like for the server to be able to send something to the client (a packet, something), and for the client to be waiting for this. Then, as soon as the client receives from the server what it is waiting for, it kicks into action. Basically,

Client sitting, waiting... ho-hum
Server sends knock-knock.
Client wakes up, kicks into action and does what it needs to do.

Any help with this is greatly appreciated. A nudge in the right direction would even be great. Thanks all!

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

Replies are listed 'Best First'.
Re: Server sends knock-knock, client does something.
by Corion (Patriarch) on Jul 30, 2013 at 07:20 UTC

    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.

Re: Server sends knock-knock, client does something.
by Skeeve (Parson) on Jul 30, 2013 at 07:19 UTC

    Consider looking into snmp. It's for this purpose.


    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
Re: Server sends knock-knock, client does something.
by Loops (Curate) on Jul 30, 2013 at 07:20 UTC