RF communication problem between two nRf24l01+ modules

Hi , I am trying some basic communication between two RF modules with hint from the maniac bug programming example.
The transmitter part code:

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

 
RF24 radio(8,7);
int msg[1]; 

const uint64_t pipe = 0xE8E8F0F0E1LL;
 
void setup(void)
{
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(pipe);
}
 
void loop(void)
{
   


  for( int i = 0; i < 10; i++)
  //if (digitalRead(SW1) == HIGH)
  {
  msg[0] = i;
  radio.write(msg, 1);

  delay(1000);

  }
}

The receiver side code

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

F24 radio(48,49);
int msg[1];
const uint64_t pipe = 0xE8E8F0F0E1LL;
 
void setup(void)
{
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(1,pipe);
  radio.startListening();
}
 
void loop(void)
{
  if ( radio.available() )
  {
    // Dump the payloads until we've gotten everything
    bool done = false;
    while (!done)
    {
      // Fetch the payload, and see if this was the last one.
      done = radio.read(msg, 1);      
    Serial.println(msg[0]);
   delay(500);
    }
  }
  else
  {
    Serial.println("No radio available");
  }
}

In serial port terminal getting output as
255
255
255

I have tried communication with a non RF24 based library system and it worked. I guess it is not much to do with power. I am using RF24 libraries as it gives whole lot of flexibilities.
Can anyone pls help?

The way to tell whether there are messages available to be read is to call radio.available(). Calling radio.read() reads the next message but doesn't tell you whether there are any following messages.