split tcp/udp servers out of main()