Beispiel #1
0
#print 'Connection address:', addr

conn = None

while 1:

	try:
		conn, addr = s.accept()
		#print 'Connection address:', addr
		data = conn.recv(BUFFER_SIZE)
	
		if data:
#			print "received data:", data
			
			# decoding the data
			msgDec = tcpMessageDecoder(data)
			
			# storing content to database
			if(msgDec.isMsgValid()):
				dbEx = dbDataExchange()
				dbEx.addRecord(msgDec)
	
			# tcp stuff
			conn.send(data)  # echo
			conn.close()
			
	except KeyboardInterrupt:
		# most of the time not created when ctr + c
		if(conn):
			conn.close()
Beispiel #2
0
from tcpMessageDecoder import *

from dbDataExchange import *


msg = "140321190607,+33624267358,GPRMC,180607.683,A,4335.9151,N,00127.1699,E,0.00,32.59,210314,,,A*5D,F,, imei:013227007709334,05,144.3,F:3.79V,0,139,21644,208,01,320F,1F24"
#msg = ""
msgDec = tcpMessageDecoder(msg)
#print(msgDec.toString())


if(msgDec.isMsgValid()):
	dbEx = dbDataExchange()
	dbEx.addRecord(msgDec)