private void dhcpResponse(){
        int responseTime = -1;

        // create request packet
        LOG.info("create request packet");
        byte[] requestMessage = createRequestMessage();
        DatagramPacket requestPacket = null;
        try {
            requestPacket = new DatagramPacket(requestMessage,
                    requestMessage.length,
                    InetAddress.getByName(BroadcastIp),
                    DHCPServerPort);
        } catch (UnknownHostException e) {
        }

        // send request packet
        LOG.info("begin to send request message");
        long startTime = System.currentTimeMillis();
        try {
            socket.send(requestPacket);
            socket.setSoTimeout(ResponseTimeOut);
        } catch (IOException e) {
            LOG.error("failed to send request message", e);
            result.setResponseTime(responseTime);
            result.setError(DetectResult.DHCP_SEND_REQUEST_FAILED, "Failed to send request message");

            return;
        }

        // wait offer response message
        LOG.info("wait for DHCP ack message");
        boolean gotMessage = false;
        byte[] ackMessage = new byte[512];
        DatagramPacket ackDatagramPacket = new DatagramPacket(ackMessage, ackMessage.length);
        try {
            while (!gotMessage){
                socket.receive(ackDatagramPacket);

                // parse received message
                LOG.info("received a message and parse it");
                // charge transition id
                byte[] byteOfXID = new byte[]{ackMessage[4],ackMessage[5], ackMessage[6],ackMessage[7] };
                int offerXid = Util.bytes2Int(byteOfXID);
                LOG.info("offerXid of the received message is " + offerXid + ", and transactionID is " + transactionID);

                if (offerXid == transactionID){
                    DHCPPacket ackDHCPPacket = DHCPPacket.getPacket(ackDatagramPacket);
                    short ackMessageType = ackDHCPPacket.getOption(DHCPConstants.DHO_DHCP_MESSAGE_TYPE).getValue()[0];

                    if (ackMessageType == DHCPConstants.DHCPACK){   // for ack message
                        result.setError(DetectResult.DETECT_SUCCESS, "");
                        gotMessage = true;
                    } else if (ackMessageType == DHCPConstants.DHCPNAK){    // for nack message
                        String errorMessage = ackDHCPPacket.getOptionAsString(DHCPConstants.DHO_DHCP_MESSAGE);

                        LOG.error("Receive dhcp nak message, "+errorMessage);
                        result.setError(DetectResult.DHCP_RECV_NACK_RESPONCE, "Receive dhcp nak message, "+errorMessage);
                        gotMessage = true;
                    } else {
                        LOG.error("the received message is not ack or nack message, the message type is "+ackMessageType);
                    }
                }
            }

            responseTime = (int)(System.currentTimeMillis() - startTime);
        } catch(SocketTimeoutException e){
            LOG.error("Time out exception happened while wait for DHCP Ack message", e);
            result.setError(DetectResult.DHCP_RECV_ACK_TIMEOUT, "Wait for DHCP ACK message timeout");
        } catch (IOException e) {
            LOG.error("IO exception happened while wait for DHCP ACK message", e);
            result.setError(DetectResult.DHCP_RECV_ACK_FAILED, "Failed to receive DHCP ACK message");
        }

        result.setResponseTime(responseTime);
    }