[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.
It depends on the platform (sometimes `sizeof(int) == sizeof(long)`), but you are of course completely right.

A decent fix would be to assign to a temporary `long` variable and only assign to `port` after checking the range. Like this:

```c
   long lport = strtol(ip_end + 1, NULL, 10);
   if (lport <= 0 || lport > 0xffff) {
      // Invalid port, treat as named pipe or unix socket
      server_type = kServerTypePipe;
    } else {
      port = (int) lport;
    }
```

Added a check for `<=` since technically a user could specify `*:-9874`.