Struct ServerAddress
- Namespace
- IceRpc
- Assembly
- IceRpc.dll
A server address specifies the address of the server-end of an ice or icerpc connection: a server listens on a server address and a client establishes a connection to a server address.
[TypeConverter(typeof(ServerAddressTypeConverter))]
public readonly record struct ServerAddress : IEquatable<ServerAddress>
- Implements
- Inherited Members
Constructors
ServerAddress()
Constructs a server address with default values.
public ServerAddress()
ServerAddress(Protocol)
Constructs a server address from a supported protocol.
public ServerAddress(Protocol protocol)
Parameters
protocolProtocolThe protocol.
ServerAddress(Uri)
Constructs a server address from a Uri.
public ServerAddress(Uri uri)
Parameters
uriUriAn absolute URI.
Exceptions
- ArgumentException
Thrown when
uriis not an absolute URI, or when its scheme is not a supported protocol, or when it has a non-empty path or fragment, or when it has an empty host, or when its query can't be parsed or has an alt-server query parameter.
Properties
Host
Gets or initializes the host.
public string Host { get; init; }
Property Value
- string
The host of this server address. Defaults to
::0meaning that the server will listen on all the network interfaces. This default value is parsed into IPv6Any.
Remarks
When you initialize this property with a bracketed IPv6 address such as [::1], the brackets
are stripped: the property value is the IPv6 address without brackets.
OriginalUri
Gets the URI used to create this server address.
public Uri? OriginalUri { get; }
Property Value
Params
Gets or initializes transport-specific parameters.
public ImmutableDictionary<string, string> Params { get; init; }
Property Value
- ImmutableDictionary<string, string>
The server address parameters. Defaults to Empty.
Port
Gets or initializes the port number.
public ushort Port { get; init; }
Property Value
- ushort
The port number of this server address. Defaults to DefaultPort.
Protocol
Gets the protocol of this server address.
public Protocol Protocol { get; }
Property Value
Transport
Gets or initializes the transport.
public string? Transport { get; init; }
Property Value
Methods
Equals(ServerAddress)
Checks if this server address is equal to another server address.
public bool Equals(ServerAddress other)
Parameters
otherServerAddressThe other server address.
Returns
- bool
true when the two server addresses have the same properties, including the same parameters; otherwise, false.
GetHashCode()
Computes the hash code for this server address.
public override int GetHashCode()
Returns
- int
The hash code.
ToString()
Converts this server address into a string.
public override string ToString()
Returns
- string
The string representation of this server address.
ToUri()
Converts this server address into a URI.
public Uri ToUri()
Returns
- Uri
The URI.