The port on which the service is listening for connections.
SDKs
- iOS 2.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- Foundation
Declaration
var port: Int { get }
Discussion
If the object was initialized by calling init(domain:
(whether by your code or by a browser object), then the value was set when the object was first initialized.
If the object was initialized by calling init(domain:
, the value of this property is not valid (-1
) until after the service has successfully been resolved (when addresses
is non-nil
).
Backward Compatibility Note
This became a property in OS X v10.9 and iOS 7, but the underlying getter method (port
) has been available since this class was first introduced.