Class NetUtils
Some specific network utilities
Inheritance
System.Object
NetUtils
Namespace: LiteNetLib
Assembly: LiteNetLib.dll
Syntax
public static class NetUtils
Methods
GetLocalIp(LocalAddrType)
Get first detected local ip address
Declaration
public static string GetLocalIp(LocalAddrType addrType)
Parameters
Type | Name | Description |
---|---|---|
LocalAddrType | addrType | type of address (IPv4, IPv6 or both) |
Returns
Type | Description |
---|---|
System.String | IP address if available. Else - string.Empty |
GetLocalIpList(LocalAddrType)
Get all local ip addresses
Declaration
public static List<string> GetLocalIpList(LocalAddrType addrType)
Parameters
Type | Name | Description |
---|---|---|
LocalAddrType | addrType | type of address (IPv4, IPv6 or both) |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | List with all local ip adresses |
GetLocalIpList(IList<String>, LocalAddrType)
Get all local ip addresses (non alloc version)
Declaration
public static void GetLocalIpList(IList<string> targetList, LocalAddrType addrType)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<System.String> | targetList | result list |
LocalAddrType | addrType | type of address (IPv4, IPv6 or both) |
MakeEndPoint(String, Int32)
Declaration
public static IPEndPoint MakeEndPoint(string hostStr, int port)
Parameters
Type | Name | Description |
---|---|---|
System.String | hostStr | |
System.Int32 | port |
Returns
Type | Description |
---|---|
System.Net.IPEndPoint |
ResolveAddress(String)
Declaration
public static IPAddress ResolveAddress(string hostStr)
Parameters
Type | Name | Description |
---|---|---|
System.String | hostStr |
Returns
Type | Description |
---|---|
System.Net.IPAddress |