Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Server sends knock-knock, client does something.

by Anonymous Monk
on Jul 30, 2013 at 07:13 UTC ( [id://1046959]=perlquestion: print w/replies, xml ) Need Help??

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!

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1046959]
Approved by Skeeve
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-03-29 02:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found