const STATE_ERROR = 3;
function sendPacket(socket, srcMAC, type, serverIP, yourIP) {
  // Request info option
  const opt55 = {
    id: 55,
    bytes: [
      1, // subnet
      3, // router
      6, // dns
    ],
  };

  let options;
  if (serverIP && yourIP) {
    const opt54 = {
      id: 54,
      bytes: [serverIP.a, serverIP.b, serverIP.c, serverIP.d],
    };
    const opt50 = {
      id: 50,
      bytes: [yourIP.a, yourIP.b, yourIP.c, yourIP.d],
    };
    options = [opt55, opt54, opt50];
  } else {
    options = [opt55];
  }

  const u8 = dhcpPacket.create(type, srcMAC, options);
  socket.send(IP4Address.BROADCAST, 67, u8);
}