This is all new to me...

How do you do it, exactly? Does it only work for cities actually on the coast? Does it work if your port is blockaded?