Receiver xbee receiving data even if the Transmitter is not sending? TX code:

#include &lt;SoftwareSerial.h&gt;

const int MAX_LENGTH = 2;
char buffer[MAX_LENGTH];
char lineFeed = 2;

SoftwareSerial   Xbee(10, 11);

void setup() {
  Serial.begin(9600);
  Xbee.begin(9600);
}

void loop() {
  int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
  int i = 0;
  while( i &lt; length )
  { 
    Serial.print(buffer[i]-48); 
    Xbee.print(buffer[i]-48);  
    i++;
  }        
}


RX code:

const int MAX_LENGTH = 2;
char buffer[MAX_LENGTH];
char lineFeed = 2;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int length = Serial.readBytesUntil(lineFeed, buffer, MAX_LENGTH);
  int i = 0;

  while( i &lt; length )
  { 
    Serial.print(buffer[i]-48);
    i++;
  } 
}


NOTE : 

1- The Rx xbee is receiving data even if am not sending and even if the TX xbee is powered off

2- When i send data from the TX xbee id didn't get revived by the RX xbee 

I need to solve both problems.

*** What i need exactly is to send serial data from my pc to arduino and send it wireless through xbee and then receive to the other arduino connected to my circuit
The reason that it is printing characters with no input is that the readBytesUntil function has a timeout. If no new characters are received for a certain amount of time, "Serail.setTimeout()" seconds, it will just continue with the code. the default timeout is 1 second.

The reason you are not receiving what you transmit (or at least a reason) is that the RX code does not read from an xbee, but reads from regular "serial".

I recommend you try something simple first to test the xbee's configuration, like having TX run this:

void loop(){
    xbee.println("Hello");
    delay(1000);
}


and RX run something to echo serial like this:

 void loop(){
     if(xbee.available()){
         Serial.print((char)xbee.read());
     }
}


And make sure you set up an xbee object an the receiving side first.