C# Class Lidgren.Network.NetUtility

Afficher le fichier Open project: tomoprime/CrabBattle Class Usage Examples

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
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

Method Details

BytesToHoldBits() public static méthode

Returns how many bytes are required to hold a certain number of bits
public static BytesToHoldBits ( int numBits ) : int
numBits int
Résultat int

GetMacAddress() public static méthode

Returns the physical (MAC) address for the first usable network interface
public static GetMacAddress ( ) : System.Net.NetworkInformation.PhysicalAddress
Résultat System.Net.NetworkInformation.PhysicalAddress

GetMyAddress() public static méthode

Gets my local IP address (not necessarily external) and subnet mask
public static GetMyAddress ( IPAddress &mask ) : IPAddress
mask System.Net.IPAddress
Résultat System.Net.IPAddress

GetWindowSize() public static méthode

Gets the window size used internally in the library for a certain delivery method
public static GetWindowSize ( NetDeliveryMethod method ) : int
method NetDeliveryMethod
Résultat int

IsLocal() public static méthode

Returns true if the IPAddress supplied is on the same subnet as this host
public static IsLocal ( IPAddress remote ) : bool
remote System.Net.IPAddress
Résultat bool

IsLocal() public static méthode

Returns true if the IPEndPoint supplied is on the same subnet as this host
public static IsLocal ( IPEndPoint endpoint ) : bool
endpoint System.Net.IPEndPoint
Résultat bool

Resolve() public static méthode

Get IPv4 address from notation (xxx.xxx.xxx.xxx) or hostname
public static Resolve ( string ipOrHost ) : IPAddress
ipOrHost string
Résultat System.Net.IPAddress

Resolve() public static méthode

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
Résultat System.Net.IPEndPoint

ToByteArray() public static méthode

Convert a hexadecimal string to a byte array
public static ToByteArray ( String hexString ) : byte[]
hexString String
Résultat byte[]

ToHexString() public static méthode

Create a hex string from an array of bytes
public static ToHexString ( byte data ) : string
data byte
Résultat string

ToHexString() public static méthode

Create a hex string from an Int64 value
public static ToHexString ( long data ) : string
data long
Résultat string

ToHumanReadable() public static méthode

Converts a number of bytes to a shorter, more readable string representation
public static ToHumanReadable ( long bytes ) : string
bytes long
Résultat string