Adding connect to server function