coreserver: Add helper for checking whether port is unused

Signed-off-by: Michael Buesch <m@bues.ch>
coreserver: Fix memarea reads on Python 2

Signed-off-by: Michael Buesch <m@bues.ch>