Facility Control

 View Only
  • 1.  Set listener UDP port via OGscript?

    Posted 11-14-2017 19:55
    Hey All:

    "‹Does anyone know of a way to set the UDP port of a listener via ogscript? I have multiple panels which are identical except for an ID param and the listener port and I'd like to give the operator the ability to change this setting without having to go into edit mode...

    Any thoughts?

    "‹CJ


  • 2.  RE: Set listener UDP port via OGscript?

    Posted 11-16-2017 00:34

    Could you do this?

    var myListener = ogscript.getListenerById('myListener');
    myListener.stop();
    myListener.connecthost = '192.168.1.1';
    myListener.connectport = '12345';
    myListener.start();

    I don't know if those are writable values to the listener object or not, the documentation was not clear.

    I currently do it like this in my panels:

    <listener autostart="false" connecthost="%const['hosts']['device1.address']%" connectport="%const['hosts']['device1.port']%" delimitertype="newline" id="myListener">

    And then I have those host/port values defined in my lookups:

    <lookup access="1" id="hosts">
             <entry key="device1.address">192.168.1.1</entry>
             <entry key="device1.port">12345</entry>
    </lookup>

    So if the first method doesn't work, maybe you could programmatically stop the listener, change the lookup key values, and then restart the listener. I haven't tried it, so just a guess!


    #DashBoard


  • 3.  RE: Set listener UDP port via OGscript?

    Posted 11-16-2017 19:39

    You can also use

    var myListener = ogscript.getListenerById('myListener');
    myListener.setPort(12345);

    to change the port number of an existing listener.


    #DashBoard


  • 4.  RE: Set listener UDP port via OGscript?

    Posted 12-28-2017 00:54
    Thanks Guys! I ended up using the myListener.setPort method...a bit easier for me as I'm still learning :-) Works perfectly!

    Best,

    CJ



    #DashBoard