Example #1
0
    def run(self):
        global received
        self.running = True
        print "Connecting to Server"
        host = '10.0.0.30'
        ##        host = '91.205.155.231'
        port = 11000

        while self.running:
            self.index = 0

            try:
                self.connection = socket.socket()
                self.connection.connect((host, port))
                print "Socket connected"

                while self.running:
                    engines.socketConnectedLights()

                    for x in range(0, 10):
                        time.sleep(0.1)

        ##            sendData(index)

                    self.toSend = str(self.index) + ";" + str(
                        getLongitude()) + ';' + str(getLatitude()) + ';' + str(
                            getAltitude()) + ';' + str(getTime())
                    print "Send to server " + self.toSend
                    self.connection.send(self.toSend)

                    received = self.connection.recv(1024)
                    print "Recived from server: " + str(received)
                    ##            sendData(index)
                    self.index += 1
            except Exception, err:
                print(traceback.format_exc())
Example #2
0
def sendData(index):
    global connector
    toSend = str(index) + ";" + str(getLongitude()) + ';' + str(getLatitude()) + ';' + str(getAltitude()) + ';' + getTime()
    print "Send to server " + toSend
    connector.connection.send(toSend)
Example #3
0
    def run(self):
        global received
        self.running = True
        print "Connecting to Server"
        host = '10.0.0.30'
##        host = '91.205.155.231'
        port = 11000

        while self.running:
            self.index = 0
            
            try:
                self.connection = socket.socket()
                self.connection.connect((host,port))
                print "Socket connected"

                while self.running:
                    engines.socketConnectedLights()
                
                    for x in range(0, 10):
                        time.sleep(0.1)

        ##            sendData(index)
                          
                    self.toSend = str(self.index) + ";" + str(getLongitude()) + ';' + str(getLatitude()) + ';' + str(getAltitude()) + ';' + str(getTime())
                    print "Send to server " + self.toSend
                    self.connection.send(self.toSend)
                    
                    received = self.connection.recv(1024)
                    print "Recived from server: " + str(received)
        ##            sendData(index)
                    self.index += 1
            except Exception, err:
                    print(traceback.format_exc())                
Example #4
0
def sendData(index):
    global connector
    toSend = str(index) + ";" + str(getLongitude()) + ';' + str(
        getLatitude()) + ';' + str(getAltitude()) + ';' + getTime()
    print "Send to server " + toSend
    connector.connection.send(toSend)