Change type of variables tcp_socket / udp_socket to signed integer

Method socket (Socket API) returns -1 in case of an error. To properly handle errors, variables tcp_socket / udp_socket must be signed integers.