internal DHCPRequest(byte[] data, Socket socket, DHCPServer server)
 {
     dhcpServer = server;
     System.IO.BinaryReader rdr;
     System.IO.MemoryStream stm = new System.IO.MemoryStream(data, 0, data.Length);
     rdr = new System.IO.BinaryReader(stm);
     // Reading data
     requestData.op = rdr.ReadByte();
     requestData.htype = rdr.ReadByte();
     requestData.hlen = rdr.ReadByte();
     requestData.hops = rdr.ReadByte();
     requestData.xid = rdr.ReadBytes(4);
     requestData.secs = rdr.ReadBytes(2);
     requestData.flags = rdr.ReadBytes(2);
     requestData.ciaddr = rdr.ReadBytes(4);
     requestData.yiaddr = rdr.ReadBytes(4);
     requestData.siaddr = rdr.ReadBytes(4);
     requestData.giaddr = rdr.ReadBytes(4);
     requestData.chaddr = rdr.ReadBytes(16);
     requestData.sname = rdr.ReadBytes(64);
     requestData.file = rdr.ReadBytes(128);
     requestData.mcookie = rdr.ReadBytes(4);
     requestData.options = rdr.ReadBytes(data.Length - OPTION_OFFSET);
     requestSocket = socket;
 }
 internal DHCPRequest(byte[] data, Socket socket, DHCPServer server)
 {
     dhcpServer = server;
     System.IO.BinaryReader rdr;
     System.IO.MemoryStream stm = new System.IO.MemoryStream(data, 0, data.Length);
     rdr = new System.IO.BinaryReader(stm);
     // Reading data
     requestData.op      = rdr.ReadByte();
     requestData.htype   = rdr.ReadByte();
     requestData.hlen    = rdr.ReadByte();
     requestData.hops    = rdr.ReadByte();
     requestData.xid     = rdr.ReadBytes(4);
     requestData.secs    = rdr.ReadBytes(2);
     requestData.flags   = rdr.ReadBytes(2);
     requestData.ciaddr  = rdr.ReadBytes(4);
     requestData.yiaddr  = rdr.ReadBytes(4);
     requestData.siaddr  = rdr.ReadBytes(4);
     requestData.giaddr  = rdr.ReadBytes(4);
     requestData.chaddr  = rdr.ReadBytes(16);
     requestData.sname   = rdr.ReadBytes(64);
     requestData.file    = rdr.ReadBytes(128);
     requestData.mcookie = rdr.ReadBytes(4);
     requestData.options = rdr.ReadBytes(data.Length - OPTION_OFFSET);
     requestSocket       = socket;
 }
 static void Main(string[] args)
 {
     var server = new DHCPServer();
     server.ServerName = "SharpDHCPServer";
     server.OnDataReceived += Request;
     Console.WriteLine("Running DHCP server. Press enter to stop it.");
     Console.ReadLine();
     server.Dispose();
 }