Professional Documents
Culture Documents
//s is a class or structure that shall contain a refernce to the UDP client
try
{
//get the udp client
u = (UdpClient)((UdpState)(asyn.AsyncState)).u;
//get the endpoint (shall contain refernce about the client)
e = (IPEndPoint)((UdpState)(asyn.AsyncState)).e;
//stop the callback and get the number of bytes recieved
DataRcvd(receiveBytes, e);
}
catch (Exception ex)
{
if (IsListening == true)
Console.WriteLine(ex.Message);
}
finally
{
u = null;
e = null;
receiveBytes = null;
// recall the call back, ie go and listen for more data
IniListnerCallBack();
}
}
dStruct.D_op = rdr.ReadByte();
dStruct.D_htype = rdr.ReadByte();
dStruct.D_hlen = rdr.ReadByte();
dStruct.D_hops = rdr.ReadByte();
dStruct.D_xid = rdr.ReadBytes(4);
dStruct.D_secs = rdr.ReadBytes(2);
dStruct.D_flags = rdr.ReadBytes(2);
dStruct.D_ciaddr = rdr.ReadBytes(4);
dStruct.D_yiaddr = rdr.ReadBytes(4);
dStruct.D_siaddr = rdr.ReadBytes(4);
dStruct.D_giaddr = rdr.ReadBytes(4);
dStruct.D_chaddr = rdr.ReadBytes(16);
dStruct.D_sname = rdr.ReadBytes(64);
dStruct.D_file = rdr.ReadBytes(128);
dStruct.M_Cookie = rdr.ReadBytes(4);
//read the rest of the data, which shall determine the dhcp
//options
//end option is the mark that shall signify the end of the message