Add port suffix to REALM variable

This replaces PR #634