Hi all,
Currently working on a project with a TCP Server and could use some help. The reliability of the core’s connections are very iffy right now and I could use some help from experts… Below is my python code
#buf is our output file
spark_core = '10.0.0.7'
sc_port = 17061
BUFFER_SIZE = 2048
#just about the right amount of time to wait in between sending
perfect_time = 0.015
#print buf
print "Trying to socket and connect"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
for x in xrange(2):
try:
s.connect((spark_core, sc_port))
print "connected"
for x in buf:
s.send(x)
time.sleep(perfect_time)
print "Done sending"
s.close()
break
except:
print "Failure"
Here is a pastebin of my Core code: http://pastebin.com/YYw0kzct
The output I get is usually like:
""“
updating
Trying to socket and connect
connected
Done sending
updating
Trying to socket and connect
connected
Done sending
updating
… (anywhere from 10 seconds to 5 minutes later) …
Trying to socket and connect
Failure
Failure
updating
Trying to socket and connect
Failure
Failure
updating
Trying to socket and connect
Failure
Failure
…(continues in this fashion, and most of the time results in the Core rebooting)…
”""
Edit: When the core does reboot, it usually takes a few attempts to actually get a connection again.
Forgot to mention, I am also having trouble flashing after a connection has already been made to the device. I have to turn it off and on again then try to reflash.