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
protocol
ProtocolThe protocol.
ServerAddress(Uri)
Constructs a server address from a Uri.
public ServerAddress(Uri uri)
Parameters
uri
UriAn absolute URI.
Exceptions
- ArgumentException
Thrown if
uri
is not an absolute URI, or if its scheme is not a supported protocol, or if it has a non-empty path or fragment, or if it has an empty host, or if its query can't be parsed or if it 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
::0
meaning that the server will listen on all the network interfaces. This default value is parsed into IPv6Any.
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
other
ServerAddressThe 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.