[RDY] fix TCP connection (issue #870)

This fixes the broken TCP connection. It does not change the functions used to copy the IP address. Maybe there are some more improvements to be made here as described in issue #870.
If the problem with ```long``` is only because of ```clint``` we can avoid it with comment ```//NOLINT```.