# How could I create a PC application to connecte with zigbee gateway in LAN

**URL:** <https://forums.digi.com/t/how-could-i-create-a-pc-application-to-connecte-with-zigbee-gateway-in-lan/15853>\
**Category:** Python\
**Tags:** gui, python, xbee\
**Created:** [November 26, 2015, 10:51am UTC](https://forums.digi.com/t/how-could-i-create-a-pc-application-to-connecte-with-zigbee-gateway-in-lan/15853 "2015-11-26T10:51:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhen](https://avatars.discourse-cdn.com/v4/letter/z/a88e57/32.png) [@zhen](https://forums.digi.com/u/zhen)\
**Post date:** [November 26, 2015, 10:51am UTC](https://forums.digi.com/t/how-could-i-create-a-pc-application-to-connecte-with-zigbee-gateway-in-lan/15853/1 "2015-11-26T10:51:26Z")

</div>

Hi,

As the title said, how could I make a GUI application in PC (not web), to connect with my Zigbee gateway and then control a smartplug. Is it possible?

Thank you!  
Best regard!

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [November 30, 2015, 3:33pm UTC](https://forums.digi.com/t/how-could-i-create-a-pc-application-to-connecte-with-zigbee-gateway-in-lan/15853/2 "2015-11-30T15:33:09Z")

</div>

Sure it is. It is a matter of you creating a socket to the IP address of the gateway. Then send some pre defined data that issue a remote AT command to the radio setting the proper DIO line as a output high or low turning on the Plug on and off.

---

<div class="post-metadata">

**Author:** ![zhen](https://avatars.discourse-cdn.com/v4/letter/z/a88e57/32.png) [@zhen](https://forums.digi.com/u/zhen)\
**Post date:** [November 30, 2015, 8:11pm UTC](https://forums.digi.com/t/how-could-i-create-a-pc-application-to-connecte-with-zigbee-gateway-in-lan/15853/3 "2015-11-30T20:11:53Z")

</div>

Thank you for your response.  
I can use socket to simple connect with the gateway successfully, but how could I get the information and send command? when I use “s = socket(AF\_XBEE, SOCK\_DGRAM, XBS\_PROT\_TRANSPORT)”, it show “NameError: name ‘AF\_XBEE’ is not defined”.

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [December 1, 2015, 9:39am UTC](https://forums.digi.com/t/how-could-i-create-a-pc-application-to-connecte-with-zigbee-gateway-in-lan/15853/4 "2015-12-01T09:39:56Z")

</div>

The DIA 2.3.1.1 XBee DIO sample shows you how to send remote AT commands to the XBee modules and open a socket to them.
