Fix crash for udp clients due to invalid use of local variable
Add configuration setting to make client connect through tcp