private void createSocketAndSend(String msg, int flag) throws IOException{
        DatagramSocket clientSocket = new DatagramSocket();
        String[] ipNumbers = hostIP.split("\\.");
        byte[] ip = {(byte) Integer.parseInt(ipNumbers[0]),
                     (byte) Integer.parseInt(ipNumbers[1]),
                     (byte) Integer.parseInt(ipNumbers[2]),
                     (byte) Integer.parseInt(ipNumbers[3]) };
        InetAddress IPAddress = InetAddress.getByAddress(ip);
        byte[] sendData = new byte[2048*8];
        byte[] receiveData = new byte[2048*8];
        String requestMessage = msg;
        sendData = requestMessage.getBytes();
        DatagramPacket sendPacket = new DatagramPacket(sendData,
                                                       sendData.length, IPAddress,
                                                       P2PUDPServer.UDPSERVER_PORT);
        clientSocket.send(sendPacket);
        DatagramPacket receivePacket = new DatagramPacket(receiveData,
                                                          receiveData.length);
        clientSocket.receive(receivePacket);
        String peerList = new String(receivePacket.getData());
        System.out.println("Response Message From Server : " + peerList);
        if (flag == CONNECT){
            unpackList(peerList);
        }
        clientSocket.close();
    }