Пример #1
0
def main():
    webconfig = configs.WebServerConfig()
    chatconfig = configs.ChatServerConig()
    web_request_handler = requesthandler.WebRequestHandler(webconfig)
    chat_request_handler = requesthandler.ChatRequestHandler(chatconfig)

    chatsrver = server.ChatServer(chat_request_handler)
    webserver = server.WebServer(chatsrver, web_request_handler)

    webserverthread = threading.Thread(target=webserver.start, args=())
    webserverthread.start()

    print("server started at {0}:{1}".format(webconfig.server_ip,
                                             webconfig.server_port))

    chatserverthread = threading.Thread(target=chatsrver.start, args=())
    chatserverthread.start()

    print("chatserver started at {0}:{1}".format(chatconfig.server_ip,
                                                 chatconfig.server_port))
            if self.hardware.get_state() == hi.MANUAL:
                if not started:
                    print "Recording..."
                    started = True

                self.vision.save_frame(2, self.path)
                frame_count += 1
            else:
                if started:
                    print "Stopped."
                    print "{0} frames saved.".format(frame_count)
                    started = False
                    frame_count = 0

            sleep(0.1)

if __name__ == "__main__":
    path = raw_input("Please enter path: ")

    if len(path) == 0:
        path = "test"
    # make the main thread and start it
    main = Main(path)
    main.start()
    # make the frame streaming server. This gets main control flow.
    server.register_vision(main.vision)
    server = server.WebServer(('0.0.0.0', 5000), server.CamHandler)
    server.serve_forever()

Пример #3
0
def main():
    web_server = server.WebServer()
    web_server.server_start()
    while 1:
        data = web_server.GET_response()
        print(data)