SSH or Telnet Login via logic

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Damaxx, Jun 22, 2016.

  1. Damaxx

    Damaxx

    Joined:
    May 12, 2008
    Messages:
    229
    Likes Received:
    47
    I have recently installed a power distribution rail for my server rack that can take simple ASCII commands via either SSH or telnet. Can any of the Logic gurus point me in the right direction of how to approach the login/username requirements of writeclientsocket.

    I have in my initialisation module (with obvious obfuscations for obvious reasons:) )
    Code:
    OpenClientSocket(1, '192.168.etc.etc', xx);
    Then in module InitSocket -
    Code:
    if ClientSocketConnected(1) then
      begin
      Format(Enlogic_SendString, username, #13#10);
      WriteClientSocket(1, Elogic_SendString);
      ReadClientSocket(1, Elogic_Reply, '');
      logmessage(Elogic_Reply);
      Delay(5);
      Format(Elogic_SendString, pass, #13#10);
      WriteClientSocket(1, Elogic_SendString);
      ReadClientSocket(1, Elogic_Reply, '');
      logmessage(Elogic_Reply);
      {send test code to switch outlet 5 off and to ensure login has worked}
      WriteClientSocket(1, 'rack 1 outlet 5 off');
      DisableModule("InitSocket");
      end
    else
        begin
       logmessage('GET HELP BEFORE HEAD EXPLODES');
        end;
    But it never logs in and the logs show what is received if I was to log into the unit via PuTTy -
    Code:
    6/22/2016 8:12:42 PM  Logic    : User Name : 
    6/22/2016 8:12:47 PM  Logic    : ????
    
    Then nothing so I can only assume it has rejected the login.
     
    Damaxx, Jun 22, 2016
    #1
  2. Damaxx

    djaggar

    Joined:
    Jul 18, 2009
    Messages:
    66
    Likes Received:
    0
    Location:
    New Zealand
    Maybe try a delay between the writes and reads so that there is time for the something to arrive ??
     
    djaggar, Jun 24, 2016
    #2
  3. Damaxx

    Damaxx

    Joined:
    May 12, 2008
    Messages:
    229
    Likes Received:
    47
    Appreciate the reply djaggar and yep, you were spot on.

    After some serious tinkering today I got the comms working with adding a couple of delays and a few log messages to see what was going on.

    Thanks.
     
    Damaxx, Jun 24, 2016
    #3
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.