Can an XBee in API mode receive data through serial?

Following the python-Xbee library I am trying to communicate between 2 XBees

Using XBee S2C
Setup:
Coordinator API=2, running the code in python @ Mac
Router AT mode, running python code @ Mac

Below data sending code runs in API mode at coordinator

#!/usr/bin/python

#this code runs on the xbee coordinator that is set to API mode 2

import serial
from xbee import ZigBee
from xbee.helpers.dispatch import Dispatch
import time

PORT = ‘/dev/tty.usbserial-A104IC2U’
BAUD_RATE = 9600

UNKNOWN = ‘\xff\xfe’
WHERE = ‘\x00\x13\xA2\x00\x40\xF7\x0A\x50’
dataString='Hello

Open serial port

ser = serial.Serial(PORT, BAUD_RATE)

zb = ZigBee(ser)

#sends data to xbee address
def sendData(address, datatosend):
zb.send(‘tx’, dest_addr_long = address, dest_addr = UNKNOWN, data = datatosend)

#test data sending method
while True:
try:
sendData(WHERE, dataString)
except KeyboardInterrupt:
break

zb.halt()
ser.close()

And in the router (AT mode) I run below code

#!/usr/bin/python

import serial

#router port
PORT = ‘/dev/tty.usbserial-A104IAUX’
BAUD_RATE = 9600
ser = serial.Serial(PORT, BAUD_RATE)

#myaddress - its the router
ack=‘0013A20040F70A50’

while True:
incoming = ser.readline().strip()
if incoming != ‘0013A20040F70A50’:
print ‘%s’ % incoming
ser.write(‘%s’ % ack)

ser.close()

This works fine and I see the output ‘Hello’ on the router side python terminal at Mac. Now I also need to receive data in the coordinator side. So I do this in the coordinator code - after sending, it also reads the serial and prints data

while True:
try:
sendData(WHERE, dataString)
incoming = ser.readline().strip() #added to receive serial data at coordinator
print ‘%s’ % incoming
except KeyboardInterrupt:
break

But as soon as I add those two lines, the communication stops. Is this because coordinator is in API mode and can’t receive in serial? And I have to write the receive code for API mode? Any suggestion?

API mode is Serial. What you need to do is to consider putting your read function in a while loop.

sorry… i want to ask…
how to print data ony without print the acknowledgment between xbee s2 in API mode???
please help me,

how about the sketch…

thx very much