Facility Control

 View Only
  • 1.  TCP Bytes not passing through Listener

    Posted 01-06-2022 09:55

    Hi All,

    I have something odd happening on a Custom Panel I'm writing.

    I'm sending a TCP byte message to some kit and based upon the response, performing actions in my panel.

    The issue i'm seeing is that although I can see the response in Wireshark to a message I send, I can't get my listener in Dashboard to give me any output.

    It works fine if I send a different message that just happens to be 1 byte longer. But the way I've got the task setup it should grab all the bytes anyway.

    Here's the code I'm using on the Listener task:

    if (event.isMessageEvent())
    ogscript.debug("Got message");
    var data = [];
    //get the first byte
    var datapush = event.getBytes();
    ogscript.debug("datapush = " + datapush);
    var stream = this.getInputStream();
    ogscript.debug("Data available: " + stream.available()); //print message length
    //get the rest of the bytes in the message and add to array
    while( stream.available())
    var CONNECTED = new Array();
    CONNECTED[0] = data;
    params.setValue('CONNECTED' , 0, CONNECTED.toString());
    ogscript.debug("CONNECTED STRING = " + CONNECTEDSTRING);
    var replace = params.getValue('CONNECTED', 0).replace(/,/g, " ");
    ogscript.debug("replace = " + replace);
    var split = replace.split(" ");
    ogscript.debug("split = " + split);
    var Checksum = split[5];
    ogscript.debug("Checksum RX = " + Checksum);

    and a screenshot of my listener setup:

    I'd be really grateful for some help with this one please.



    Chris Mason

  • 2.  RE: TCP Bytes not passing through Listener

    Ross Staff
    Posted 01-27-2022 10:52
    I've never used "Fixed Length" delimiters, and it seems a little odd that each one is just 1 byte long.     But I guess it's possible if you're just sending one byte messages.  Although your ogscript code seems to expect multiple bytes. 

    I typically use the "New Line" delimiter, and make sure that all my messages end with new line characters.    That way I can have variable length messages coming through.

    Ben Gatien
    Ross Video