C# Класс Lidgren.Network.NetUtility

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BytesToHoldBits ( int numBits ) : int

Returns how many bytes are required to hold a certain number of bits

GetMacAddress ( ) : System.Net.NetworkInformation.PhysicalAddress

Returns the physical (MAC) address for the first usable network interface

GetMyAddress ( IPAddress &mask ) : IPAddress

Gets my local IP address (not necessarily external) and subnet mask

GetWindowSize ( NetDeliveryMethod method ) : int

Gets the window size used internally in the library for a certain delivery method

IsLocal ( IPAddress remote ) : bool

Returns true if the IPAddress supplied is on the same subnet as this host

IsLocal ( IPEndPoint endpoint ) : bool

Returns true if the IPEndPoint supplied is on the same subnet as this host

Resolve ( string ipOrHost ) : IPAddress

Get IPv4 address from notation (xxx.xxx.xxx.xxx) or hostname

Resolve ( string ipOrHost, int port ) : IPEndPoint

Get IPv4 endpoint from notation (xxx.xxx.xxx.xxx) or hostname and port number

ToByteArray ( String hexString ) : byte[]

Convert a hexadecimal string to a byte array

ToHexString ( byte data ) : string

Create a hex string from an array of bytes

ToHexString ( long data ) : string

Create a hex string from an Int64 value

ToHumanReadable ( long bytes ) : string

Converts a number of bytes to a shorter, more readable string representation

Приватные методы

Метод Описание
BitsToHoldUInt ( uint value ) : int
CompareElements ( byte one, byte two ) : bool
GetDeliveryMethod ( NetMessageType mtp ) : NetDeliveryMethod
GetNetworkInterface ( ) : NetworkInterface
RelativeSequenceNumber ( int nr, int expected ) : int
SortMembersList ( System list ) : void
SwapByteOrder ( UInt32 value ) : UInt32
SwapByteOrder ( System.UInt64 value ) : System.UInt64

Описание методов

BytesToHoldBits() публичный статический Метод

Returns how many bytes are required to hold a certain number of bits
public static BytesToHoldBits ( int numBits ) : int
numBits int
Результат int

GetMacAddress() публичный статический Метод

Returns the physical (MAC) address for the first usable network interface
public static GetMacAddress ( ) : System.Net.NetworkInformation.PhysicalAddress
Результат System.Net.NetworkInformation.PhysicalAddress

GetMyAddress() публичный статический Метод

Gets my local IP address (not necessarily external) and subnet mask
public static GetMyAddress ( IPAddress &mask ) : IPAddress
mask System.Net.IPAddress
Результат System.Net.IPAddress

GetWindowSize() публичный статический Метод

Gets the window size used internally in the library for a certain delivery method
public static GetWindowSize ( NetDeliveryMethod method ) : int
method NetDeliveryMethod
Результат int

IsLocal() публичный статический Метод

Returns true if the IPAddress supplied is on the same subnet as this host
public static IsLocal ( IPAddress remote ) : bool
remote System.Net.IPAddress
Результат bool

IsLocal() публичный статический Метод

Returns true if the IPEndPoint supplied is on the same subnet as this host
public static IsLocal ( IPEndPoint endpoint ) : bool
endpoint System.Net.IPEndPoint
Результат bool

Resolve() публичный статический Метод

Get IPv4 address from notation (xxx.xxx.xxx.xxx) or hostname
public static Resolve ( string ipOrHost ) : IPAddress
ipOrHost string
Результат System.Net.IPAddress

Resolve() публичный статический Метод

Get IPv4 endpoint from notation (xxx.xxx.xxx.xxx) or hostname and port number
public static Resolve ( string ipOrHost, int port ) : IPEndPoint
ipOrHost string
port int
Результат System.Net.IPEndPoint

ToByteArray() публичный статический Метод

Convert a hexadecimal string to a byte array
public static ToByteArray ( String hexString ) : byte[]
hexString String
Результат byte[]

ToHexString() публичный статический Метод

Create a hex string from an array of bytes
public static ToHexString ( byte data ) : string
data byte
Результат string

ToHexString() публичный статический Метод

Create a hex string from an Int64 value
public static ToHexString ( long data ) : string
data long
Результат string

ToHumanReadable() публичный статический Метод

Converts a number of bytes to a shorter, more readable string representation
public static ToHumanReadable ( long bytes ) : string
bytes long
Результат string