Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

How to cast BatchResults getValue(n) property to int in ModBus TCP/IP

  •     BatchRead<Integer> batch = new BatchRead<Integer>();
        int add;
        int reg;
        int typ;
        add = FEOHdb.intDB[1][3];
       for (int m = 1 ; m < FEOHdb.tDev; m++){
    	   add = FEOHdb.intDB[m][3];
        for (int n = 1; n < FEOHdb.mapQty; n++ ){
        reg =FEOHdb.mapInt[n][1];
        typ =FEOHdb.mapInt[n][2];
       	batch.addLocator(n-1, BaseLocator.holdingRegister(add, reg, typ));
        try {
            while (pool) {
                BatchResults<Integer> results = master.send(batch);
                for (int n = 0; n < FEOHdb.mapQty; n++){ 
                	System.out.println("Value =  " + (int) results.getValue(n));

  • Try casting it to java.lang.Number instead

  • Thank you so much it works.