public static void RECEIVEACK() {
        System.out.println("IN RECEIVE MODE");
        try {
            System.out.println("Inside receiveAck");
            byte[] receiveData = new byte[90];
            System.out.println("socket created, waiting to receive");
            DatagramSocket listenSocket = new DatagramSocket(listenPort);
            while (true) {
                try {
                    DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
                    listenSocket.receive(receivePacket);
                    String received = new String(receivePacket.getData());

                    receiveData = receivePacket.getData();

                    ByteArrayInputStream in = new ByteArrayInputStream(receiveData);
                    ObjectInputStream is = new ObjectInputStream(in);

                    Packet packet = (Packet) is.readObject();

                    System.out.println("RCVD | #" + packet.getSeqNum() + " | " + paxType(packet.getPacketType()));
                    writer.println("RCVD | #" + packet.getSeqNum() + " | " + paxType(packet.getPacketType()));

                    //If the packet is not an EOT, 
                    if (packet.getPacketType() == 1) {

                        //Convert the packet into an ACK
                        packet.setPacketType(2);
                    } else if (packet.getPacketType() == 3) {
                        System.out.println("GOT AN EOT, SETTING TO EOTACK");
                        packet.setPacketType(5);

                    }

                    DatagramSocket sendSocket = new DatagramSocket();
                    if (packet.getPacketType() ==5){
                    sendPacket(packet, sendSocket);
                    writer.close();
                    }
                    else{
                    sendPacket(packet, sendSocket);
                    }

                } catch (IOException ex) {
                    Logger.getLogger(HostB.class.getName()).log(Level.SEVERE, null, ex);
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(HostB.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        } catch (SocketException ex) {
            Logger.getLogger(HostB.class.getName()).log(Level.SEVERE, null, ex);
        }

    }