XBee Node Discovery

I am attempting a “Node Discovery” using Xbee radios.
I have the following sketch:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);

unsigned char nodeDiscovery[] = {0x7E,0x00,0x04,0x08,0x01,0x4E,0x44,0x64};



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

void loop()
{
// listen for incomming data:
if (mySerial.available() > 0){
	listenToXbee();
	}
}

void nodeDiscover() {
   Serial.println("Node Discovery");
  for (int c=0; c<8;c++) {
    mySerial.write(nodeDiscovery[c]);
  }
}

void listenToXbee(){
// read incoming data:
int inByte = mySerial.read();
// beginning of new packet is 0x7E:
if (inByte == 0x7E){
Serial.println();

}

// print the bytes:
Serial.print(inByte, HEX);
}

This outputs to the Serial Monitor:

Node Discovery

7E0DA1013A204063DB46C47400AD
7E02A8814E440C474013A204063DB4645434F5452454E442D4E4F4445320FFFE10C15101E030065

How can I discard the first data packet received (API “A1”):
7E0DA1013A204063DB46C47400AD

and only use the second data packet (API “88”):
7E02A8814E440C474013A204063DB4645434F5452454E442D4E4F4445320FFFE10C15101E030065

Any help would be greatly appreciated.

How can I discard the first data packet received (API "A1"):

You are not doing anything with either packet except printing to the serial monitor.

Collect the data in an array, instead. When the end of packet arrives, check the 2nd element in the array, and discard if it is not the desired type.

I have no idea as to how to collect the data in an array etc.
Sorry I am new to C

Sorry I am new to C

Then, you will need to learn. That, or fail your class.

I am attempting to learn

Well, I am still learning C as well, and I am also trying to get an xbee network up and running.

Seems to me that you could simply use a >= command in the serial call, i.e.;

if (Serial.available() >= 23)//make sure buffer is full { if (Serial.read() == 0x7E)// look for start byte { mySerial.print(Serial.read); }}

this was referenced from the book "building wireless sensor networks" i bought. not sure that the structure is ideal or even correct, but might help.

You might also use a byte discard or bit shift command to get to the data you need.