Interface IServerAddressProvider
Interface for a service that provides server address information. Removes the responsibility from the Server class itself.
public interface IServerAddressProvider
Methods
TryGetServerIPAddress(out ServerAddress)
Attempts to get the server's IP address (either IPv4 or IPv6).
bool TryGetServerIPAddress(out ServerAddress address)
Parameters
addressServerAddressWhen this method returns, contains the server address if found; otherwise, the default value.
Returns
- bool
trueif an IP address was found; otherwise,false.
TryGetServerIPv4AddressFromTransport(out ServerAddress)
Attempts to get the server's IPv4 address from the transport layer.
bool TryGetServerIPv4AddressFromTransport(out ServerAddress address)
Parameters
addressServerAddressWhen this method returns, contains the IPv4 server address if found; otherwise, the default value.
Returns
- bool
trueif the IPv4 address was found; otherwise,false.
TryGetServerIPv6AddressFromTransport(out ServerAddress)
Attempts to get the server's IPv6 address from the transport layer.
bool TryGetServerIPv6AddressFromTransport(out ServerAddress address)
Parameters
addressServerAddressWhen this method returns, contains the IPv6 server address if found; otherwise, the default value.
Returns
- bool
trueif the IPv6 address was found; otherwise,false.