# Python example "Hello world", how does it work?

**URL:** <https://forums.digi.com/t/python-example-hello-world-how-does-it-work/11497>\
**Category:** Python\
**Tags:** socket, x4, python, connectport, xbee\
**Created:** [May 16, 2013, 4:01am UTC](https://forums.digi.com/t/python-example-hello-world-how-does-it-work/11497 "2013-05-16T04:01:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexSong](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@AlexSong](https://forums.digi.com/u/AlexSong)\
**Post date:** [May 16, 2013, 4:01am UTC](https://forums.digi.com/t/python-example-hello-world-how-does-it-work/11497/1 "2013-05-16T04:01:03Z")

</div>

Hello everyone,  
I am a new beginer with Digi ESP. I am trying to do a simple test using ESP python sample XbeeHello.py to establish communication between two ConnectPort Xfamily devices.  
As wirten from the Python Programing Guid, I want to send “Hello, world!” to a fixed node address. I loaded below python example into ConnectPort X4 to run with DESTINATION address modified, and sent the"Hello world" to my ConnectPortX2 device.  
import sys, os  
import xbee  
from socket import \*

# The Format of the tuple is:

# (address\_string, endpoint, profile\_id, cluster\_id)

# 

# The values for the endpoint, profile\_id, and

# cluster\_id given below are the values used to write

# to the serial port on an Ember-based XBee module.

DESTINATION=(“00:13:a2:00:40:4a:3b:5c!”, 0xe8, 0xc105, 0x11)

# Create the socket, datagram mode, proprietary transport:

sd = socket(AF\_XBEE, SOCK\_DGRAM, XBS\_PROT\_TRANSPORT)

# Bind to endpoint 0xe8 (232):

sd.bind((“”, 0xe8, 0, 0))

# Send “Hello, World!” to the destination node, endpoint,

# using the profile\_id and cluster\_id specified in

# DESTINATION:

sd.sendto(“Hello, World!”, 0, DESTINATION)

After that I want to receive "Hello world " from my desitination address which is the ConnectPortX2 device. what should I do? Should I use the reading and wirting example to receive and payload back? I am not sure how to do next step. I tried many time from theTelnet, however, it doesn’t work.  
Can any one help me?  
Thank in advance..

Alex Song

---

<div class="post-metadata">

**Author:** ![kjensen8](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@kjensen8](https://forums.digi.com/u/kjensen8)\
**Post date:** [June 7, 2013, 1:25pm UTC](https://forums.digi.com/t/python-example-hello-world-how-does-it-work/11497/2 "2013-06-07T13:25:20Z")

</div>

you would need to have a python app running on the X2 that would receive the ‘hello world’ zigbee packet. it will be something like:  
payload, address = sd.recv(160)
