xdmp:get-request-port() as xs:integer?
Returns the port of the request.
xdmp:get-request-port() => 8000