added handling of the port parameter if it is set by the application