# Cannot read data using "recvfrom"

**URL:** <https://forums.digi.com/t/cannot-read-data-using-recvfrom/11577>\
**Category:** Python\
**Tags:** x4, connectport\
**Created:** [June 10, 2013, 11:59am UTC](https://forums.digi.com/t/cannot-read-data-using-recvfrom/11577 "2013-06-10T11:59:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miye](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@Miye](https://forums.digi.com/u/Miye)\
**Post date:** [June 10, 2013, 11:59am UTC](https://forums.digi.com/t/cannot-read-data-using-recvfrom/11577/1 "2013-06-10T11:59:12Z")

</div>

Hello,

I just started with Xbee world, and need your help on this problem. I have a Connectport X4 DM 900, and an Xbee module DP 900. I installed DM firmware on the Xbee module and tried to send api packets to the gateway. When I use command “set trace state=on mask=xbee:\*” in a Terminal, I can see the data flows like this:

1704425:xbee:DEBG:RECV:  
1704425:xbee:DEBG: 0: 7e 00 1c 92 00 13 a2 00 40 9a 1b 8e ff fe 01 01 ~…@…  
1704425:xbee:DEBG: 10: 00 00 3f 13 ff 02 ff 06 ff 02 ff 01 ff 03 ff eb …?..  
1704509:xbee:DEBG:RECV:  
1704509:xbee:DEBG: 0: 7e 00 1c 92 00 13 a2 00 40 9a 1b 8e ff fe 01 01 ~…@…  
1704509:xbee:DEBG: 10: 00 00 3f 01 ff 02 ff 03 ff 03 ff 01 ff 03 ff eb …?..

I opened another terminal and run sample codes in [http://www.digi.com/wiki/developer/index.php/UDP\_to\_XBee\_Network](http://www.digi.com/wiki/developer/index.php/UDP_to_XBee_Network), everything was fine until it reached command “data, addr = zig\_sock.recvfrom(255)”, and it seemed to hang forever, even though at that time I can still see the data flows in the other terminal window.

Could you please tell me why?

Thank you

---

<div class="post-metadata">

**Author:** ![16ksa23](https://avatars.discourse-cdn.com/v4/letter/1/aeb1de/32.png) [@16ksa23](https://forums.digi.com/u/16ksa23)\
**Post date:** [September 13, 2013, 9:22am UTC](https://forums.digi.com/t/cannot-read-data-using-recvfrom/11577/2 "2013-09-13T09:22:46Z")

</div>

Use the code with Try and Except cluse and print the error. It tells what is wrong with the recv()

---

<div class="post-metadata">

**Author:** ![charliek](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@charliek](https://forums.digi.com/u/charliek)\
**Post date:** [September 18, 2013, 1:24pm UTC](https://forums.digi.com/t/cannot-read-data-using-recvfrom/11577/3 "2013-09-18T13:24:03Z")

</div>

Take a look at how you bound the socket, DigiMesh requires either an endpoint of 0xe8 at 2.4ghz or 0x00 at 900mhz.
