Show / Hide Table of Contents

Class NatReader

Reads NAT data items from a stream.

Inheritance
Object
NatReader
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
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 Source

NatReader(Stream)

Creates a new instance of the NatReader on the specified Stream.

Declaration
public NatReader(Stream stream)
Parameters
Type Name Description
Stream stream

The destination for data items.

Properties

| Improve this Doc View Source

Position

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 Source

ReadByte()

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.

| Improve this Doc View Source

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 length bytes in the stream.

Exceptions
Type Condition
EndOfStreamException

When no more data is available.

| Improve this Doc View Source

ReadIPv4Address()

Read an IPv4 address.

Declaration
public IPAddress ReadIPv4Address()
Returns
Type Description
IPAddress
| Improve this Doc View Source

ReadIPv6Address()

Read an IPv6 address.

Declaration
public IPAddress ReadIPv6Address()
Returns
Type Description
IPAddress
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX