Communicating with a drive using modbusTCP

Then comment out all the server B code.

Since you have a lot of messages that are similar, assign a unique number to each one. That is how real systems are built.

Also, you are using a variable before you determine what to store in it. That is your bug I think.

Is a 'lift' what I call an elevator? As a former 'lift' designer I never saw any code like this.