introlab / odas

ODAS: Open embeddeD Audition System
MIT License
780 stars 248 forks source link

ODAS_CORE will stopped after sending data for one time with custom socket server #75

Open chad1023 opened 6 years ago

chad1023 commented 6 years ago

We tried to write the socket server just like ODAS_WEB and launch the ODAS_CORE with command: bin/odascore -c config/test2_local.cfg -v However, the core will stopped after sending data for one time while running continuously with ODAS_WEB.

2018-06-25 5 59 23

Should our server send any message to ODAS_CORE for continuous connection?

FrancoisGrondin commented 6 years ago

This is strange. In a few days, a brand new version of ODAS that uses only sockets will be available, and should solve most of these issues. Stay tuned :)

chad1023 commented 6 years ago

In our understanding, the server.js is the file about the socket for tracking mode. We tried to write the server with python:

import socket
import threading
import SocketServer
import json, types,string
import os, time

class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
    def handle(self):
        data = self.request.recv(1024)
        jdata = json.loads(data)
        print "Receive data from '%r'" %(data)
        print "Receive jdata from '%r'" %(jdata)

class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
    pass

if __name__ == "__main__":

    HOST, PORT = "10.211.55.3", 9000

    SocketServer.TCPServer.allow_reuse_address = True
    server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
    ip, port = server.server_address

    server_thread = threading.Thread(target=server.serve_forever)
    print (ip, port)

    server_thread.daemon = True
    server_thread.start()
    print "Server loop running in thread:", server_thread.name
    print " .... waiting for connection"

    server.serve_forever()

Does electron server send any message to ODAS_CORE for continuous connection?

Btw, when would your new version ready? Would you also add config file for respeaker?

FrancoisGrondin commented 6 years ago

I've added my colleague @GodCed for the odasweb part, as he's the main author and knows more about it than me.

The new version is quite ready, we're currently running some experiments to test its robustness. I'm leaving for vacations for a few days, and then when I'm back I should be ready for a release. In the meantime you can already play with it in the dev branch. I've added some basic doc to explain how to use it, but I need to spend more time making the doc.

GodCed commented 6 years ago

Hi, the server doesn't have to send anything back to the ODAS Core during operation. It only has to open a socket for each data stream coming for ODAS and parse the incoming data.

However, a colleague of mine wrote a Python Server for ODAS and had this kind of problem. I think he changed the library he was using or followed another tutorial to make it work. If I remember correctly, it had something to do with the Python socket and how it handled continuous data stream.