Class NatReader
Reads NAT data items from a stream.
Inherited Members
Namespace: Makaretu.Nat
Assembly: Makaretu.Nat.dll
Syntax
public class NatReader
Remarks
NatReader is used to read data items from a NAT-PCP or NAT-PMP stream.
Constructors
| Improve this Doc View SourceNatReader(Stream)
Declaration
public NatReader(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The destination for data items. |
Properties
| Improve this Doc View SourcePosition
The position within the stream.
Declaration
public int Position { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 | The current position in the stream. |
Methods
| Improve this Doc View SourceReadByte()
Read a byte.
Declaration
public byte ReadByte()
Returns
| Type | Description |
|---|---|
| Byte | The next byte in the stream. |
Exceptions
| Type | Condition |
|---|---|
| EndOfStreamException | When no more data is available. |
ReadBytes(Int32)
Read the specified number of bytes.
Declaration
public byte[] ReadBytes(int length)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | length | The number of bytes to read. |
Returns
| Type | Description |
|---|---|
| Byte[] | The next |
Exceptions
| Type | Condition |
|---|---|
| EndOfStreamException | When no more data is available. |
ReadIPv4Address()
Read an IPv4 address.
Declaration
public IPAddress ReadIPv4Address()
Returns
| Type | Description |
|---|---|
| IPAddress |
ReadIPv6Address()
Read an IPv6 address.
Declaration
public IPAddress ReadIPv6Address()
Returns
| Type | Description |
|---|---|
| IPAddress |
ReadTimeSpan()
Read a time span (interval)
Declaration
public TimeSpan ReadTimeSpan()
Returns
| Type | Description |
|---|---|
| TimeSpan | A TimeSpan with second resolution. |
Remarks
The interval is represented as the number of seconds in four bytes.
Exceptions
| Type | Condition |
|---|---|
| EndOfStreamException | When no more data is available. |
ReadUInt16()
Read an unsigned short.
Declaration
public ushort ReadUInt16()
Returns
| Type | Description |
|---|---|
| UInt16 | The two byte little-endian value as an unsigned short. |
Exceptions
| Type | Condition |
|---|---|
| EndOfStreamException | When no more data is available. |
ReadUInt32()
Read an unsigned int.
Declaration
public uint ReadUInt32()
Returns
| Type | Description |
|---|---|
| UInt32 | The four byte little-endian value as an unsigned int. |
Exceptions
| Type | Condition |
|---|---|
| EndOfStreamException | When no more data is available. |