Alarm data integration

Thank you for tips and links.
Simple and efficient way could be also using pure Tcp connection, and some binary protocol.

import SocketServer
import time

class MyTCPHandler(SocketServer.BaseRequestHandler):

def handle(self):
	self.data = self.request.recv(1024).strip()
	print self.data
	#read data from connection, parameters f.ex.
	#and here alarm data could be read and sent to active connection
	self.request.send(self.data.upper())
	time.sleep(2)
	#connection is closed after sending data back, in this example

print “starting”
server = SocketServer.TCPServer((“192.168.1.19”, 2345), MyTCPHandler)
server.serve_forever()

1 Like