Hello, i have a beaglebone black. i have two python code.
One to communicate on uart with hercules. With crontab I can run this code automatically on boot and test it with hercules.
But,
Initially my code is not working even though I followed the same steps for tcp communication.
I follow these steps for crontab.
crontab -e
@reboot sudo python /root/python_code.py &
-----------------------------------
not working at startup code
--------------------------------------
import socket
import time
host = '192.168.1.80'
port = 23
while True:
TestServer = socket.socket()
TestServer.bind((host,port))
TestServer.listen(1)
c, addr = TestServer.accept()
print ('Connection from: ' + str(addr))
while True:
data = c.recv(1024)
if not data:
break
print "data: " + data
#data = str(data).upper()
data = "feedback: " +data+ " data received \n"
print "sending feedback"
c.send(str(data))
c.close()
time.sleep(1)