Forum: Cfengine Help
Subject: readtcp with empty send string: how to use?
Author: dfriedman
Link to topic: https://cfengine.com/forum/read.php?3,17768,17768#msg-17768

I want to test whether or not something is listening on a specified port, and 
restart it if it isn't.

Documentation for the readtcp function says:

"If the send string is empty, no data are sent or received from the socket. 
Then the function only tests whether the TCP port is alive and returns an empty 
variable."

Is there an example anywhere of how one could actually use this?

The only readtcp examples I can find are:

- The one in the manual, which works great if I'm testing an HTTP server. In 
this case I am not.

- This one by Neil W, which doesn't seem to work: 
https://cfengine.com/forum/read.php?3,16633,16634#msg-16634
By "doesn't seem to work" I mean, if I use the same code, it returns the same 
result whether or not the service I am testing is listening on the given port.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to