public void Release(DhcpV4Message ackMsg) { msg = BuildReleaseMessage(ackMsg); //ChannelFuture future = channel.write(msg, server); //future.addListener(this); Console.WriteLine(msg.ToString()); }
public void Discover() { msg = BuildDiscoverMessage(mac); //ChannelFuture future = channel.write(msg, server); //future.addListener(this); Console.WriteLine(msg.ToString()); Request(msg); }
private static void V4Release() { var V4Message = new DhcpV4Message(IPAddress.Any, new IPEndPoint(IPAddress.Parse("192.168.61.48"), DhcpConstants.V4_SERVER_PORT)); V4Message.SetOp((short)DhcpConstants.V4_OP_REQUEST); //V4_OP_REQUEST V4Message.SetGiAddr(IPAddress.Parse("192.168.101.1")); V4Message.SetCiAddr(IPAddress.Parse("192.168.5.126")); V4Message.SetChAddr(PhysicalAddress.Parse("9C-EB-E8-28-92-D4").GetAddressBytes()); V4Message.SetHlen(6); V4Message.SetHtype((byte)6); V4Message.SetTransactionId(-1729018559); DhcpV4MsgTypeOption msgTypeOption = new DhcpV4MsgTypeOption(); msgTypeOption.SetUnsignedByte((short)DhcpConstants.V4MESSAGE_TYPE_RELEASE); V4Message.PutDhcpOption(msgTypeOption); var message = DhcpV4MessageHandler.HandleMessage( IPAddress.Parse("192.168.61.48"), V4Message); Console.WriteLine(V4Message.ToString()); }