API Not Returning Expected Results

Below is my sample code snippet.

Open port appear to work , and isOpen returns true.

GetSelectedBank is returning 251 each time, when my expectation is it should return a 0(zero) since i am selecting all banks. Not sure if Select Bank works or now, but if I set it to a value outside the range of 0-32, it does complain about an invalid value.

Each of the TurnOnRelay command is returning false. Not sure if this is a result of possibly a failure in SelectBank?

Anyway, I am unable to turn the relays on or off at this point.

Any help would be appreciated.

NCD.NCDComponent ncdComponent = new NCD.NCDComponent();

        ncdComponent.IPAddress = "192.168.1.3";
        ncdComponent.Port = 9999;
        ncdComponent.IsTwoWay = true;
        ncdComponent.ReadTimeOut = 1000;
        ncdComponent.UsingComPort = false;

        ncdComponent.OpenPort();
        Console.WriteLine("Port Open: {0}", ncdComponent.IsOpen);

        ncdComponent.ProXR.RelayBanks.SelectBank(0);
        Console.WriteLine("Selected Bank: {0}", ncdComponent.ProXR.RelayBanks.GetSelectedBank());

        Console.WriteLine("Turn ON Relay 0: {0}", ncdComponent.ProXR.RelayBanks.TurnOnRelay(0));
        Console.WriteLine("Turn ON Relay 1: {0}", ncdComponent.ProXR.RelayBanks.TurnOnRelay(1));
        Console.WriteLine("Turn ON Relay 2: {0}", ncdComponent.ProXR.RelayBanks.TurnOnRelay(2));
        Console.WriteLine("Turn ON Relay 3: {0}", ncdComponent.ProXR.RelayBanks.TurnOnRelay(3));
        Console.WriteLine("Turn ON Relay 4: {0}", ncdComponent.ProXR.RelayBanks.TurnOnRelay(4));
        Console.WriteLine("Turn ON Relay 5: {0}", ncdComponent.ProXR.RelayBanks.TurnOnRelay(5));
        Console.WriteLine("Turn ON Relay 6: {0}", ncdComponent.ProXR.RelayBanks.TurnOnRelay(6));
        Console.WriteLine("Turn ON Relay 7: {0}", ncdComponent.ProXR.RelayBanks.TurnOnRelay(7));

Hi Bstill,
It could be old lib or wrong object.
What is your relay part#? Could you compress and send me your sample code? I will have a look.
Thanks,
Shirui Xu

Im using a ZUXP8xProXR. I have a 16 port AD expansion board attached.

The above code is the entirety of a console app that displays the problem.

I’m just getting started with this, and downloaded the latest API directly from this site… The DLL is from 12/10/2014, so its quite old anyway.

Hi Bstill,
I got your code. Please try port 2101.
The default tcp /ip port is 2101 for network.
Thanks,
Shirui Xu

BStill,
Btw, please run NCD base to make sure the ethernet module and board works correct.
Please also make sure there is only one program connects module through 2101. The module won’t accept multi connections.
Shirui Xu

I cant get NCD Base to connect either. Im troubleshooting that now…

I basically have my PC and the board connected through a router.

Is there anything special i need to do to get it to see the board?

I tried port 2101 and I get a timeout exception.

any ideas?

port 9999 works for me, I can telnet and get the setup and get connected via the API. with port 2101, i get timeout errors.

Via a TCP connection port 80 works.

Hi,

Port 9999 is the telnet setup port and port 80 is the HTTP port. Both will accept a TCP socket because those protocols are built on TCP communications, but will not forward the data over the serial line of the module to the Relay Board.

Can you go to the module’s IP address in your browser and post a screenshot of both the Serial Settings and Connection pages under Channel 1 on the left?

That would be why im getting what im getting then… Here are the screenshots…

Looks like it went through a factory reset at some point.

Under Serial Settings change the Baud Rate to 115200.

Under Connection change Local Port to 2101. That’s the port number you’ll need to open the TCP Socket to.

There are instructions to get it completely back to the settings we send the module out with at https://ncd.io/lantronix-xport-communications-module-quick-start-guide/ under the section titled “Clear Jumper”.

Thank you soooooo much! That did the trick!