Automatic host detection