server thread and connect function works