* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseListener extends BaseHubSystem {
+ /**
+ * Address (IP mostly) we shall listen on
+ */
+ private $listenAddress = '0.0.0.0'; // This is the default and listens on all interfaces
+
+ /**
+ * Port we shall listen on (or wait for incoming data)
+ */
+ private $listenPort = 0; // This port MUST be changed by your application
+
+ /**
+ * Wether we are in blocking or non-blocking mode (default: non-blocking
+ */
+ private $blockingMode = false;
+
/**
* Protected constructor
*
// Call parent constructor
parent::__construct($className);
}
+
+ /**
+ * Setter for listen address
+ *
+ * @param $listenAddress The address this listener should listen on
+ * @return void
+ */
+ protected final function setListenAddress ($listenAddress) {
+ $this->listenAddress = (string) $listenAddress;
+ }
+
+ /**
+ * Getter for listen address
+ *
+ * @return $listenAddress The address this listener should listen on
+ */
+ public final function getListenAddress () {
+ return $this->listenAddress;
+ }
+
+ /**
+ * Setter for listen port
+ *
+ * @param $listenPort The port this listener should listen on
+ * @return void
+ */
+ protected final function setListenPort ($listenPort) {
+ $this->listenPort = (int) $listenPort;
+ }
+
+ /**
+ * Getter for listen port
+ *
+ * @return $listenPort The port this listener should listen on
+ */
+ public final function getListenPort () {
+ return $this->listenPort;
+ }
+
+ /**
+ * "Setter" to set listen address from configuration entry
+ *
+ * @param $configEntry The configuration entry holding our listen address
+ * @return void
+ */
+ public final function setListenAddressByConfiguration ($configEntry) {
+ $this->setListenAddress($this->getConfigInstance()->readConfig($configEntry));
+ }
+
+ /**
+ * "Setter" to set listen port from configuration entry
+ *
+ * @param $configEntry The configuration entry holding our listen port
+ * @return void
+ */
+ public final function setListenPortByConfiguration ($configEntry) {
+ $this->setListenPort($this->getConfigInstance()->readConfig($configEntry));
+ }
}
// [EOF]