I guess its a duplicate of http://www.digi.com/support/forum/55821/can-transmit-recieve-data-same-xbee-series-simultaneously
The XBee modules are transceivers. You don’t need to program them to transmit or receive. You only need to feed them data and they will send/receive it automatically. Just think of the radio as nothing more than a half duplex Serial cable.