To get AOS Port number in axapta by code you can try following code in job.
Here session is class and getAOSPort is method. You can view port number in message box.
Str PortInfo;
PortInfo=strfmt("Port number of AOS IS: %1",int2str(Session::getAOSPort()));
info(PortInfo);
Here session is class and getAOSPort is method. You can view port number in message box.