|
#region
//
// Bdev.Net.Dns by Rob Philpott, Big Developments Ltd. Please send all bugs/enhancements to
// rob@bigdevelopments.co.uk This file and the code contained within is freeware and may be
// distributed and edited without restriction.
//
#endregion
using System;
using System.Net;
namespace Bdev.Net.Dns
{
/// <summary>
/// ANAME Resource Record (RR) (RFC1035 3.4.1)
/// </summary>
public class ANameRecord : RecordBase
{
// An ANAME records consists simply of an IP address
internal IPAddress _ipAddress;
// expose this IP address r/o to the world
public IPAddress IPAddress
{
get { return _ipAddress; }
}
/// <summary>
/// Constructs an ANAME record by reading bytes from a return message
/// </summary>
/// <param name="pointer">A logical pointer to the bytes holding the record</param>
internal ANameRecord(Pointer pointer)
{
byte b1 = pointer.ReadByte();
byte b2 = pointer.ReadByte();
byte b3 = pointer.ReadByte();
byte b4 = pointer.ReadByte();
// this next line's not brilliant - couldn't find a better way though
_ipAddress = IPAddress.Parse(string.Format("{0}.{1}.{2}.{3}", b1, b2, b3, b4));
}
public override string ToString()
{
return _ipAddress.ToString();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a .NET architect/developer based in London working mostly on financial trading systems. My love of computers started at an early age with BASIC on a 3KB VIC20 and progressed onto a 32KB BBC Micro using BASIC and 6502 assembly language. From there I moved on to the blisteringly fast Acorn Archimedes using BASIC and ARM assembly.
I started developing with C++ since 1990, where it was introduced to me in my first year studying for a Computer Science degree at the University of Nottingham. I started professionally with Visual C++ version 1.51 in 1993.
I moved over to C# and .NET in early 2004 after a long period of denial that anything could improve upon C++.
Recently I did a bit of work in my old language of C++ and I now realise that frankly, it's a total pain in the arse.