kw123 wrote:Connections:
1. Rpi to indigo. Either curl or socket with new data
2. Ssh sftp indigo to rpi to send config and py files
3. Socket indigo to rpi as backup and for specific quick messages
ent from my iPhone using Tapatalk
Hi
Can confirm that if I ssh in quickly and killall python process with
- Code: Select all
sudo killall python
That connection/ping and ssh stays up - varing in connection speeds but no issues.
- Code: Select all
Reply from 192.168.1.182: bytes=32 time=14ms TTL=64
Reply from 192.168.1.182: bytes=32 time=34ms TTL=64
Reply from 192.168.1.182: bytes=32 time=28ms TTL=64
Reply from 192.168.1.182: bytes=32 time=4ms TTL=64
Reply from 192.168.1.182: bytes=32 time=34ms TTL=64
Reply from 192.168.1.182: bytes=32 time=9ms TTL=64
Reply from 192.168.1.182: bytes=32 time=87ms TTL=64
Reply from 192.168.1.182: bytes=32 time=34ms TTL=64
Reply from 192.168.1.182: bytes=32 time=5ms TTL=64
Reply from 192.168.1.182: bytes=32 time=13ms TTL=64
Reply from 192.168.1.182: bytes=32 time=11ms TTL=64
Reply from 192.168.1.182: bytes=32 time=30ms TTL=64
Reply from 192.168.1.182: bytes=32 time=17ms TTL=64
Reply from 192.168.1.182: bytes=32 time=128ms TTL=64
Reply from 192.168.1.182: bytes=32 time=59ms TTL=64
Reply from 192.168.1.182: bytes=32 time=49ms TTL=64
Reply from 192.168.1.182: bytes=32 time=6ms TTL=64
Reply from 192.168.1.182: bytes=32 time=4ms TTL=64
Reply from 192.168.1.182: bytes=32 time=86ms TTL=64
Reply from 192.168.1.182: bytes=32 time=17ms TTL=64
Reply from 192.168.1.182: bytes=32 time=7ms TTL=64
Reply from 192.168.1.182: bytes=32 time=24ms TTL=64
Reply from 192.168.1.182: bytes=32 time=39ms TTL=64
Reply from 192.168.1.182: bytes=32 time=74ms TTL=64
Reply from 192.168.1.182: bytes=32 time=4ms TTL=64
Reply from 192.168.1.182: bytes=32 time=31ms TTL=64
Reply from 192.168.1.182: bytes=32 time=84ms TTL=64
Reply from 192.168.1.182: bytes=32 time=4ms TTL=64
Reply from 192.168.1.182: bytes=32 time=2ms TTL=64
Reply from 192.168.1.182: bytes=32 time=13ms TTL=64
So must be socket connection issue from piBeacon somewhere.
(rpi-182 - also has a Sensor - TMP102 Connected.)
I think it is a TCP socket issue - multiple attempts at sending; and resending; eventually hanging the tcp stack.
I found if change the piBeaconUtils.py;
Line 701 - time.sleep(0.5) to more than connection timeout of 3 - that appears to stay up/ssh/ping working
Tested an hour plus - and still up/Pings/SSH connection stays up..
- Code: Select all
for ii in range(5): # try max 5 times.
data0 = json.dumps(data)
if squeeze:
data0 = data0.replace(" ","")
sendData= str(len(data0))+"x-6-a"+name+"x-6-a"+data0
try:
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
soc.settimeout(3)
soc.connect((G.ipOfServer, G.indigoInputPORT))
len_sent = soc.send(sendData)
response = soc.recv(512)
if response.find("ok") >-1:
os.system("echo x > "+ G.homeDir+"temp/messageSend")
sendMSG =True
break
else:# try again
#print time.time(), "Sending again: send bytes: " + str(len(data0)) + " ret MSG>>"+ response+"<<"
time.sleep(3)
Not sure whether a similar sensor info timeout somewhere???
Glenn