Not receiving ack reply from API

Hello,

I have simple python script that runs on a linux board with USB Modem.
The code nicely sends the data to the API and then it sends out an email, however I never get any response back from the sever.
…What am I missing? Thanks

I know the socket.recv is blocking but shouldn’t the server reply back with OO?

Also aaaa,bbbb are my Shared keys…

# Hello world python program

from socket import socket
import sys
import time


sock = socket()
sock.connect(('23.253.146.203', 9999))


try:
    
    # Send data
	message = '{\"s\":\"aaaa\", \"c\":\"bbbb", \"d\":\"Hello,1444PM World!\", \"t\":[\"_SOCKETAPI_\"]}'
   	 
    	print >>sys.stderr, 'sending "%s"' % message
    	sock.sendall(message)
        print >>sys.stderr, 'Waiting'

	time.sleep(3)
	buff = sock.recv(2)  # Never receives OO back --- just hangs here 
	print >>sys.stderr, buff
   

finally:
    print >>sys.stderr, 'closing socket'
    sock.close()

I tried out a version of your program on my Raspberry Pi and also didn’t receive a reply. However the program didn’t hang on me.

The method I’ve been using has been to pass a shell command to commands.getstatusoutput(). For example,

response = command.getstatusoutput(‘echo ‘{“k”:“DEVICKEY”,“t”:“TAG”,“d”:“payload”}’ | nc -i1 23.253.146.203 9999’)

On return, response contains a tuple of the exit code from getstatusoutput (0, if successful) and the reply ([0,0], if successful)

By the way, I haven’t read all the documentation, but I thought only the system can assign system topics (e.g."_SOCKETAPI_"). I don’t think that has anything to do with the lack of a reply, but I’m just mentioning it in passing.