As soon as I finish this matter I'll post what happened.
But until then, some questions have risen up in my head.
Let's say we have a bunch of packets that the microcontroller has to send to pc. Every packet has the maximum size of 84 bytes, in order to efficiencies the speed of data (the loss of data over large packets is relatively small because the distance is small). What if the remote xbee sends a packet and shortly after the TX response confirmation sends another one and rewrites the receiver's buffer before the data was read. How can I prevent this thing from happening? Is there a mechanism to notify the sender?
The XBee ZB product manual does not discuss buffering method or sizes. I certainly have to think that there is room for more than one packet but of course no matter what, it is a finite resource, and not a large one at that.
Note in the ZigBee Transmit Status frame (p 112) the Delivery Status field has an entry (0x2C) "Resource error lack of free buffers, timers, etc." That would provide notification, but may not be sufficient for prevention or even for recovery. Even if the sender knows that the receiver ran short on resources, that does not tell it what the last packet successfully received was.
Best practice is to ensure that the microcontroller application always gives top priority to reading the XBee. But I would not think this sufficient in a high-link-utilization scenario like you are envisioning. It will probably require an application-level protocol to sequence number the packets and acknowledge receipt. This may be a real challenge for a microcontroller with limited SRAM space for buffer pools. Keeping the packet size small will help but of course this works against transmission efficiency. Again, XBees are low bandwidth devices, intended for occasional transmission of relatively small packets, so this application runs somewhat contrary to the XBee design goals.
And the other question is: can you indicate a library for xbee suitable for pc environments?
I cannot, but I would think that Andrew Rapp's library could be a possible starting point, assuming a C++ compiler is available on the PC.