Harm and Tracy address the skipper of the destroyer by her rank, "commander", although in the US Navy, by a long-standing tradition, it's correct to address the commanding office of a vessel as "captain" regardless of the rank of the person in question.
Twice Harm and Tracy fail to return salutes from a petty officer -- when he approaches them, and when he leaves - outdoors and while wearing their covers (headgear). To do so is a breach of courtesy. That's generally regarded as a gesture of rudeness toward the sailor.
When leaving port, the captain is giving the commands for speed and course. When entering and leaving ports, a pilot from that port will come aboard to give the correct speeds and courses. The pilots are intimately acquainted with their own ports and all possible obstacles.