diff --git a/UDP-client-server.py b/UDP-client-server.py index 9b6d1d073721e9724db89355c8a54929a79f4b33..1e9ed8abc784de2d5898c5fcf3b888f599d1ddb1 100755 --- a/UDP-client-server.py +++ b/UDP-client-server.py @@ -11,6 +11,16 @@ import pymongo # For timestamping in MongoDB import datetime +#pymongo connect +DBConHost = 'localhost' +DBConPort = 27017 +DBName = 'matningar' +DBTableName = 'stability' + +DBCon = MongoClient(DBConHost, DBConPort) +DB = DBCon[DBName] +DBTableStability = DB[DBTableName] + #DEFINE INPUTS HERE #CLIENT - SENDER @@ -223,6 +233,15 @@ def udp_client_send(UDP_DEST_IP, UDP_DEST_PORT, print("MOS: ", mos) + post = { + #"timestamp" : int(time.time()), + #Not needed since first 4bits of _id is timestamp + "stability" : mos, + "position" : False # Position appended here + } + + DBTableStability.insert(post); + #START THE THREADS FOR SENDER AND RECEIVER if __name__ == "__main__":