Here is the code for Modbus/TCP communication with the Victron CCGX using Java. Very limited sources and all the sample programs are incomplete and don’t work with the CCGX.
You need j2mod library, can be downloaded from here:
Some info about Modbus TCP master, which is what this code is:

I have not completed all device connections yet. The documentation is insufficient for me, but maybe I am just being stupid again, as in the beginning when I overlooked the field list in an excel workbook.

This is what the program prints out:

Connected to = is true
Start Register 3
AC Voltage: 246.9 V AC

Connected = false

Once I have found out how I can read the charger values from the Multis I will continue linking this to my central system for better graphical representation. The next step is to write back and stop the chargers when needed. One step at a time though . The canbus devices (Solar controllers) are not connected yet either.

Update: I was stupid again. Register 26 and 27 are DC voltage and current for/from the charger. Went thoroughly through the list again and that is the only info, with state of charge and charge mode. I will now put this into my central app and visualise the data.

import com.ghgande.j2mod.modbus.msg.ReadInputRegistersRequest;
import com.ghgande.j2mod.modbus.msg.ReadInputRegistersResponse;
@author Copyright Perth, 2016
*         You are free to use with a link to or
*         Author is not responsible for any misuse or consequential damage of
*         use with any Victron components or any other modbus unit.
public class Modbus {public static void main(String[] args) {
try {
int port        = 502;                                                  // default modbus port
int register    = 3;                                                    // register number for test – read AC volt
int count       = 1;                                                    // the number of registers to read
int slaveId     = 246;                                                  // the unit id – a multi connected to the CCGX
String ip       = “”;                                        // the CCGX in my installation
// Preparation *********************************************** 
InetAddress ipAddress = InetAddress.getByName(ip);
TCPMasterConnection connnection = new TCPMasterConnection(ipAddress);   //the connection
ModbusTCPTransaction transaction = null;                                //the transaction

ReadInputRegistersRequest readRequest = new ReadInputRegistersRequest(register,count);
ReadInputRegistersResponse readResult = new ReadInputRegistersResponse();
readRequest.setUnitID(slaveId);                                         // the device ID connected to the CCGX  
readRequest.setReference(register);                                     // the register to read            
readResult.setUnitID(slaveId);connnection.setPort(port);                // specify the port for the connection
// Execution *********************************************** 
transaction = new ModbusTCPTransaction(connnection);                    // define the transaction for an established connection
// NOTE:
// this is IMPORTANT – Victron rejects empty transaction ID – 03 – data value error 
// All internet samples I have seen ommit to prepare a proper transaction Id

// transaction.setReconnecting(true);                                   // not needed for single request
/*Print Response*/
readResult = (ReadInputRegistersResponse) transaction.getResponse();
System.out.println(“Connected to =  “+ ip + ” is “ + connnection.isConnected() );
System.out.println(“Start Register “ + register);
System.out.println(“AC Voltage: “ + readResult.getRegisterValue(0)/10.0 + ” V AC”); // get the only result – scaling is 10 – see victron field list
// Termination *********************************************** 
System.out.println(“\nConnected = “ + connnection.isConnected());
catch (Exception ex) {