.bindport does the trick in sockopen context.
however, when used in sockaccept context, it returns the port the related socklisten listens on.