Define a callback class as follows to receive the success or failure message
internal class ResponseCallback : IModbusResponseCallback
{
    public void OnSuccess(ModbusSuccessResponse success)
    {
         //handle success response
    }
    public void OnError(ModbusErrorResponse error)
    {
        //handle error response
    }
}
create a ModbusClient instance
try {
    const string hostname = “hostname”;
    const int portnumber = 502;
    ModbusSocketParameters connectionParams = new ModbusSocketParameters(hostname, portnumber, ModbusType.TCP);
    IModbusClient client = ModbusClientFactory.GetInstance().Create(connectionParams);
} catch (ModbusException e) {
//handle exception
}
 Make an asynchronous call
var slaveId = 0xFF;//identity of the device is -1 in the case of Modbus TCP/UDP
var address = 100; //address is the address of register in Modbus device 
var quantity = 12; //quantity is the number of registers to be accessed in Modbus device
var convertToHex = true; //true is to say whether the value of address to be converted as hex value or not
try{
//address is the address of the register in Modbus device 
//quantity is the number of registers to be accessed in Modbus device 
//true is to say whether the value of address to be converted as hex value or not 
     client.SubmitAsync(new ReadCoils(slaveId, address, quantity, convertToHex), new ResponseCallback()); 
}catch(ModbusException e) {
 //handle exception 
}
create a ModbusClient instance
try {
    String hostname = “hostname”;
    int portnumber = 502;
    ModbusSocketParameters connectionParams = new ModbusSocketParameters(hostname, portnumber, ModbusType.TCP);
    ModbusClient client = ModbusClientFactory.getInstance().create(connectionParams);
} catch (ModbusException e) {
//handle exception
}
 Make an asynchronous call
var slaveId = 0xFF;//identity of the device is -1 in the case of Modbus TCP/UDP
var address = 100; //address is the address of register in Modbus device 
var quantity = 12; //quantity is the number of registers to be accessed in Modbus device
var convertToHex = true; //true is to say whether the value of address to be converted as hex value or not
try{
//address is the address of the register in Modbus device 
//quantity is the number of registers to be accessed in Modbus device 
//true is to say whether the value of address to be converted as hex value or not 
   client.submitAsync(new ReadCoils(slaveId, address, quantity, convertToHex),new ModbusResponseCallback() { 
   @Override 
   public void onSuccess(ModbusSuccessResponse response) { 
      //handle the success response 
   } 
   @Override 
   public void onError(ModbusErrorResponse error) { 
      //handle the error response 
   } 
}); 
}catch(ModbusException e) {
 //handle exception 
}