Fix the MCAPI connection cache.

The writing of the port numbers have been forgotten...