C# Class Lidgren.Network.NetUtility

Mostra file Open project: tomoprime/CrabBattle Class Usage Examples

Public Methods

Method 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

Method 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 method

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

GetMacAddress() public static method

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

GetMyAddress() public static method

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

GetWindowSize() public static method

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

IsLocal() public static method

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

IsLocal() public static method

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

Resolve() public static method

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

Resolve() public static method

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
return System.Net.IPEndPoint

ToByteArray() public static method

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

ToHexString() public static method

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

ToHexString() public static method

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

ToHumanReadable() public static method

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