• Home
  • Tutorials
  • API Documentation
  • Asset Store
Show / Hide Table of Contents
  • SuperNet.Netcode.Compress
    • CompressorDeflate
    • CompressorLZF
    • ICompressor
  • SuperNet.Netcode.Crypto
    • CryptoAES
    • CryptoECDH
    • CryptoRandom
    • CryptoRSA
    • Curve25519
    • ICryptoAuthenticator
    • ICryptoEncryptor
    • ICryptoExchanger
    • ICryptoRandom
  • SuperNet.Netcode.Transport
    • ConnectionRequest
    • DisconnectReason
    • Host
    • HostConfig
    • HostEvents
    • HostStatistics
    • HostTimespan
    • HostTimestamp
    • IHostListener
    • IMessage
    • IMessageListener
    • IPeerListener
    • MessageEvents
    • MessageReceived
    • MessageSent
    • Peer
    • PeerConfig
    • PeerEvents
    • PeerStatistics
  • SuperNet.Netcode.Util
    • Allocator
    • ArrayPool<T>
    • CRC32
    • IPComparer
    • IPResolver
    • IWritable
    • ObjectPool<T>
    • Reader
    • Serializer
    • Writer
  • SuperNet.Unity.Components
    • INetworkAuthoritative
    • INetworkRegisterable
    • INetworkRollbackable
    • NetworkAnimation
    • NetworkAnimator
    • NetworkAuthority
    • NetworkPrefab
    • NetworkRegistrar
    • NetworkSpawner
    • NetworkSyncModeMethod
    • NetworkSyncModeVector2
    • NetworkSyncModeVector3
    • NetworkTransform
  • SuperNet.Unity.Core
    • NetworkComponent
    • NetworkHost
    • NetworkIdentity
    • NetworkIdentityExtensions
    • NetworkManager
  • SuperNet.Unity.Editor
    • NetworkAuthorityEditor
    • NetworkHostEditor
    • NetworkHostEditor.BandwithUnit
    • NetworkIdentityDrawer
    • NetworkManagerEditor
    • NetworkPrefabEditor
    • NetworkSpawnerEditor

Class IPResolver

Helper methods that convert a connection string to an IPEndPoint used by the netcode.

Inheritance
System.Object
IPResolver
Namespace: SuperNet.Netcode.Util
Assembly: cs.temp.dll.dll
Syntax
public static class IPResolver

Methods

GetLocalAddress()

Get local IPv4 address other machines on the same network can use to connect to us. This can be used to create LAN connections.

Declaration
public static IPAddress GetLocalAddress()
Returns
Type Description
IPAddress

Local IPv4 address or 127.0.0.1 if none found.

GetLocalAddress(Int32)

Get local IPv4 address other machines on the same network can use to connect to us. This can be used to create LAN connections.

Declaration
public static IPEndPoint GetLocalAddress(int port)
Parameters
Type Name Description
System.Int32 port

Port to use.

Returns
Type Description
IPEndPoint

Local IPv4 address or 127.0.0.1 if none found.

GetLocalAddressIPv6()

Get local IPv6 address other machines on the same network can use to connect to us. This can be used to create LAN connections.

Declaration
public static IPAddress GetLocalAddressIPv6()
Returns
Type Description
IPAddress

Local IPv6 address or ::1 if none found.

GetLocalAddressIPv6(Int32)

Get local IPv6 address other machines on the same network can use to connect to us. This can be used to create LAN connections.

Declaration
public static IPEndPoint GetLocalAddressIPv6(int port)
Parameters
Type Name Description
System.Int32 port

Port to use.

Returns
Type Description
IPEndPoint

Local IPv6 address or ::1 if none found.

Resolve(String)

Perform a synchronous DNS lookup if needed and create an IPEndPoint.

Host must be a valid IP address, followed by a colon and a port such as 192.168.12.43:80 or 127.0.0.1:44015.

Declaration
public static IPEndPoint Resolve(string host)
Parameters
Type Name Description
System.String host

Hostname with port to resolve.

Returns
Type Description
IPEndPoint

Resolved address.

Resolve(String, Action<IPEndPoint, Exception>)

Perform an asynchronous DNS lookup if needed and create an IPEndPoint. All exceptions are thrown via the callback.

Host must be a valid IP address, followed by a colon and a port such as 192.168.12.43:80 or 127.0.0.1:44015.

Declaration
public static void Resolve(string host, Action<IPEndPoint, Exception> callback)
Parameters
Type Name Description
System.String host

Hostname with port to resolve.

Action<IPEndPoint, Exception> callback

Callback to invoke after DNS lookup completes.

Resolve(String, Int32)

Perform a synchronous DNS lookup if needed and create an IPEndPoint.

Host must be a valid hostname without a port such as 192.168.12.43 or superversus.com.

Declaration
public static IPEndPoint Resolve(string host, int port)
Parameters
Type Name Description
System.String host

Hostname to resolve.

System.Int32 port

Port to use.

Returns
Type Description
IPEndPoint

Resolved address.

Resolve(String, Int32, Action<IPEndPoint, Exception>)

Perform an asynchronous DNS lookup if needed and create an IPEndPoint. All exceptions are thrown via the callback.

Host must be a valid hostname without a port such as 192.168.12.43 or superversus.com.

Declaration
public static void Resolve(string host, int port, Action<IPEndPoint, Exception> callback)
Parameters
Type Name Description
System.String host

Hostname to resolve.

System.Int32 port

Port to use.

Action<IPEndPoint, Exception> callback

Callback to invoke after DNS lookup completes.

ResolveAsync(String)

Perform an asynchronous DNS lookup if needed and create an IPEndPoint.

Host must be a valid hostname, followed by a colon and a port such as 192.168.12.43:80 or superversus.com:44015.

Declaration
public static Task<IPEndPoint> ResolveAsync(string host)
Parameters
Type Name Description
System.String host

Hostname with port to resolve.

Returns
Type Description
Task<IPEndPoint>

A valid IPEndPoint with the provided IP address and port.

ResolveAsync(String, CancellationToken)

Perform an asynchronous DNS lookup if needed and create an IPEndPoint.

Host must be a valid hostname, followed by a colon and a port such as 192.168.12.43:80 or superversus.com:44015.

Declaration
public static Task<IPEndPoint> ResolveAsync(string host, CancellationToken token)
Parameters
Type Name Description
System.String host

Hostname with port to resolve.

CancellationToken token

Cancellation token that can stop the DNS lookup before it is completed.

Returns
Type Description
Task<IPEndPoint>

A valid IPEndPoint with the provided IP address and port.

ResolveAsync(String, Int32)

Perform an asynchronous DNS lookup if needed and create an IPEndPoint.

Host must be a valid hostname without a port such as 192.168.12.43 or superversus.com.

Declaration
public static Task<IPEndPoint> ResolveAsync(string host, int port)
Parameters
Type Name Description
System.String host

Hostname to resolve.

System.Int32 port

Port to use.

Returns
Type Description
Task<IPEndPoint>

A valid IPEndPoint with the provided IP address and port.

ResolveAsync(String, Int32, CancellationToken)

Perform an asynchronous DNS lookup if needed and create an IPEndPoint.

Host must be a valid hostname without a port such as 192.168.12.43 or superversus.com.

Declaration
public static Task<IPEndPoint> ResolveAsync(string host, int port, CancellationToken token)
Parameters
Type Name Description
System.String host

Hostname to resolve.

System.Int32 port

Port to use.

CancellationToken token

Cancellation token that can stop the DNS lookup before it is completed.

Returns
Type Description
Task<IPEndPoint>

A valid IPEndPoint with the provided IP address and port.

TryParse(String)

Try to parse the host as an IP address followed by a colon and a part. This method never throws any exceptions and returns immediately.

Host must be a valid IP address, followed by a colon and a port such as 192.168.12.43:80 or 127.0.0.1:44015.

Declaration
public static IPEndPoint TryParse(string host)
Parameters
Type Name Description
System.String host

IP address with port to parse.

Returns
Type Description
IPEndPoint

Parsed IPEndPoint or null if invalid.

TryParse(String, Int32)

Try to parse the host as an IP address. This method never throws any exceptions and returns immediately.

Host must contain a valid IP address such as 192.168.12.43 or 127.0.0.1.

Declaration
public static IPEndPoint TryParse(string host, int port)
Parameters
Type Name Description
System.String host

IP address to parse.

System.Int32 port

Port to use.

Returns
Type Description
IPEndPoint

Parsed IPEndPoint or null if invalid.

Back to top Generated by DocFX