Class NetUtils
Some specific network utilities
Inheritance
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 |
|---|---|
| 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 |
|---|---|
| List<string> | List with all local ip addresses |
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 |
|---|---|---|
| IList<string> | targetList | result list |
| LocalAddrType | addrType | type of address (IPv4, IPv6 or both) |
MakeEndPoint(string, int)
Declaration
public static IPEndPoint MakeEndPoint(string hostStr, int port)
Parameters
| Type | Name | Description |
|---|---|---|
| string | hostStr | |
| int | port |
Returns
| Type | Description |
|---|---|
| IPEndPoint |
ResolveAddress(string)
Declaration
public static IPAddress ResolveAddress(string hostStr)
Parameters
| Type | Name | Description |
|---|---|---|
| string | hostStr |
Returns
| Type | Description |
|---|---|
| IPAddress |
ResolveAddress(string, AddressFamily)
Declaration
public static IPAddress ResolveAddress(string hostStr, AddressFamily addressFamily)
Parameters
| Type | Name | Description |
|---|---|---|
| string | hostStr | |
| AddressFamily | addressFamily |
Returns
| Type | Description |
|---|---|
| IPAddress |