Wiser Socket Reciving issue

Discussion in 'C-Bus Wiser 2 Controller' started by Matt, Apr 20, 2016.

  1. Matt

    Matt

    Joined:
    Aug 3, 2004
    Messages:
    28
    Likes Received:
    2
    Location:
    Cairns North Queensland
    Hi I am trying to setup my wiser to send Ir commands over tcp/ip socket to a Ethernet Ir blaster, however I am seeing in the PICED log that after sending the command it is constantly receiving the last command.
    It will continue to receive the command even after the socket has been closed and if the command is sent again it will just add it to the end of the receiving Log.


    Code:
    20/04/2016 10:30:34 PM  Logic    : Client 1 opened 192.168.0.105:4998
    20/04/2016 10:30:34 PM  Logic    : Client 1 Tx sendir,2:1,10,37091,1,1,128,64,16,48,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,48,16,16,16,48,16,48,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,1100,128,64,16,48,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,48,16,16,16,48,16,48,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,48,16,48,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,16,16,16,16,16,16,16,16,48,16,4747<13><10> (Logic Line 53)
    20/04/2016 10:30:35 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:35 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:35 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:35 PM  Logic    : Client 1 closed
    20/04/2016 10:30:35 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:35 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:36 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:36 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:36 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:36 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:36 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:37 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:37 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:37 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:38 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:38 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:39 PM  C-Bus Tx : Set 18DegON Off (User Click)
    20/04/2016 10:30:39 PM  Info     : Network 254 (Local Network) is off-line, command has been queued
    20/04/2016 10:30:40 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:41 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:41 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:41 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:41 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:42 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:42 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:42 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:42 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:42 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:43 PM  C-Bus Tx : Set 18DegON On (User Click)
    20/04/2016 10:30:43 PM  Info     : Network 254 (Local Network) is off-line, command has been queued
    20/04/2016 10:30:44 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:44 PM  Logic    : Client 1 Tx sendir,2:1,10,37091,1,1,128,64,16,48,16,16,16,16,16,16,16,48...............................
    20/04/2016 10:30:44 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:45 PM  Logic    : Client 1 Rx completeir,2:1,10<13>
    20/04/2016 10:30:45 PM  Logic    : Client 1 Rx completeir,2:1,10<13>completeir,2:1,10<13>
    20/04/2016 10:30:45 PM  Logic    : Client 1 Rx completeir,2:1,10<13>completeir,2:1,10<13>
    20/04/2016 10:30:45 PM  Logic    : Client 1 Rx completeir,2:1,10<13>completeir,2:1,10<13>
    20/04/2016 10:30:45 PM  Logic    : Client 1 Rx completeir,2:1,10<13>completeir,2:1,10<13>
    20/04/2016 10:30:45 PM  Logic    : Client 1 Rx completeir,2:1,10<13>completeir,2:1,10<13>
    
    Do i need to worry about this ?
    Will this transfer over to the wiser and cause problems later ? Or is this just a PICED Bug.


    Thanks Matthew.
     
    Matt, Apr 20, 2016
    #1
  2. Matt

    Format

    Joined:
    Jan 24, 2015
    Messages:
    9
    Likes Received:
    0
    Location:
    Adelaide, SA
    It may be possible the Ethernet IR Blaster is echoing the command back to you and you are not clearing that buffer (although once the socket is closed I would expect it would stop logging the buffer contents)

    You can check this by telnetting in to the Ethernet IR Blaster and see whether it shows anything back on the screen after you type the command in. If so then you need to read the socket repeatedly in your logic code until nothing further is returned, then close the socket.
     
    Format, Apr 22, 2016
    #2
  3. Matt

    Matt

    Joined:
    Aug 3, 2004
    Messages:
    28
    Likes Received:
    2
    Location:
    Cairns North Queensland
    Thank you for your response.

    I have tried telneting to the device and when the command is sent it only sends one completeir message and the log file continues to output the last received command even if i take the ir blaster off line buy unplugging the Ethernet cable.

    Also if I send the command several times it just adds on to the end.

    Even if I stop the logic engine the messages stop and when I restart the logic engine
    the messages start back up again where they left off.

    E.g.
    25/04/2016 9:38:22 AM Logic : Client 1 Rx completeir,2:1,10<13>completeir,2:1,10<13>completeir,2:1,10<13>completeir,2:1,10<13>
    25/04/2016 9:46:43 AM Logic : Client 1 Rx completeir,2:1,10<13>completeir,2:1,10<13>completeir,2:1,10<13>completeir,2:1,10<13>completeir,2:1,10<13>

    The code if it helps.


    Code:
    
    Variables
    {Enter Variable definitions here}
    Dakin18degOn: array[0..2000] of char;
    Dakin19DegOn: array[0..2000] of char;
     
    
    Initialisation
    {Enter Initialisation code here}
    //OpenClientSocket(1, '192.168.0.105', 4998);
    
    
    Dakin18DegOn := 'sendir,2:1,10,37091,1,1,128,64,16,48,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,48,16,16,16,48,16,48,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,48,16,16,16,16,16,16,16,16,16,';
    append(Dakin18DegOn, '16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,1100,128,64,16,48,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,48,16,16,16,');
    append(Dakin18DegOn, '48,16,48,16,16,16,48,16,48,16,48,16,48,16,48,16,16,16,16,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,16,16,16,16,16,16,48,16,48,16,16,16,16,16,16,16,16,16,48,16,16,16,16,');
    append(Dakin18DegOn, '16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,');
    append(Dakin18DegOn, '16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,');
    append(Dakin18DegOn, '16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,48,16,48,16,48,16,16,16,16,16,16,16,16,16,48,16,4747'#13#10);
    
    
    
    Module "Test"
     once GetLightingState("18DegON") = ON then
    
    begin
    OpenClientSocket(1, '192.168.0.105', 4998);
    WaitUntil(ClientSocketConnected(1));
    WriteClientSocket(1, Dakin18DegOn );
    Delay(0.8);
    CloseClientSocket(1);
    
    end;
    
    
     
    Matt, Apr 25, 2016
    #3
  4. Matt

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,554
    Likes Received:
    180
    Location:
    Adelaide, Australia
    Received data is placed in an internal buffer until you read it. The log prints out the contents of the buffer each scan. Just stick a read after the delay:

    readCLientSocket(1, tmpstring, '');

    The null terminator tells it to read everything in the buffer.
     
    Ashley, Apr 25, 2016
    #4
  5. Matt

    Matt

    Joined:
    Aug 3, 2004
    Messages:
    28
    Likes Received:
    2
    Location:
    Cairns North Queensland
    Fantastic.

    Thank you very much for your help.
     
    Matt, Apr 25, 2016
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.