Hi @bengfeld ,
Welcome to the forum..
Quick read of the manual for your product..
Looks like it's ModBus over IP not serial..
example code you posted is for ModBus over serial..
should also be able to find some libs/examples of using modbus over IP..
good luck.. ~q