Can't this line be inside initializeSocket() ?