How to retrieve 10 rows at a time with TableUtils?

I have a large table and I need to retrieve 10 rows at a time. I think I first need to retrieve one column with GETBULK and with lowerBoundIndex and upperBoundIndex set to null. This will give me a list of all table indexes. I then can call getTable with all columns and lowerBoundIndex and upperBoundIndex from the indexes list of to retrieve 10 rows at a time. Is any other way to do it? It takes a lot of time to retrieve even a single column from a table with 20,000 rows. Thanks!

You can simply set the setMaxNumRowsPerPDU to 10 in TableUtils. Then it will use GETBULK internally and retrieve all columns and all 10 rows at once with a single request (if possible).

Hi Frank,
I tried
TableUtils utils = new TableUtils(snmp, new DefaultPDUFactory(PDU.GETBULK));
utils.setMaxNumRowsPerPDU(10);
List l = utils.getTable(userTarget, columnOids, new OID(“1.3.6.1.4.1…”), null);
for (TableEvent e : l) {
System.out.println(">>> " + e);
}
I see the output contains all rows. Does it mean that all table rows are retrieved with 10 rows at a time per iteration? Is any way to just retrieve only first 10 rows? In my UI the user needs to see the first 10 table rows. The user then clicks on the Get Next button and needs to see the next 10 rows. Calling setMaxNumRowsPerPDU doesn’t seem to work this way. Thanks!

OK, I understand now what you trying to accomplish. That can be done with the asynchronous getTable method. Then simply when you have enough rows for the first page, return false in TableListener.next.
Then use the row index of the last row received as lowerBoundIndex for the next call to the asynchronous getTable method.

I cannot say how appreciative I am for all your support. Thank you, Frank!