I’m trying to connect Xbee S6 with Raspberry Pi & Python socket client. Xbee is not connected to processor/serial device. Only one sensor is conected to Xbee. I want check the state of this sensor with AT IS -command (transparent mode, serial communication service). When I’m trying to enter into the AT-command mode, Xbee closes the connection (socket.error: [Errno 104] Connection reset by peer). Why?
Code:
#!/usr/bin/env python
import socket
import time
TCP_IP = ‘192.168.0.106’
TCP_PORT = 9750
BUFFER_SIZE = 1024
MESSAGE = “+++”
delay = 1
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
time.sleep(delay)
s.send(MESSAGE)
time.sleep(delay)
data = s.recv(BUFFER_SIZE)
s.close()