Esempio n. 1
0
        //-----------------------------------------------------------------------------------------
        public ServerListenerTCP(TCP_Config config)
        {
            _config = config;

            IPAddress ip = IPAddress.Parse(_config.address);

            _listener = new TcpListener(ip, _config.port);
        }
        //-----------------------------------------------------------------------------------------
        public ClientListenerTCP(TCP_Config config)
        {
            _config = config;

            _tcpClient = new TcpClient();
        }
Esempio n. 3
0
    public void SendInitMessages()
    {
        UnityEngine.Debug.Log("sending init messages");
        //define event
        SendDefineEvent(GameClock.SystemTime_Milliseconds, TCP_Config.EventType.DEFINE, TCP_Config.GetDefineList());

        //send name of this experiment
        SendSimpleJSONEvent(GameClock.SystemTime_Milliseconds, TCP_Config.EventType.EXPNAME, TCP_Config.ExpName);

        //send exp version
        SendSimpleJSONEvent(GameClock.SystemTime_Milliseconds, TCP_Config.EventType.VERSION, Config.VersionNumber);

        //send exp session
        SendSessionEvent(GameClock.SystemTime_Milliseconds, TCP_Config.EventType.SESSION, Experiment.sessionID, TCP_Config.sessionType);
        SendSimpleJSONEvent(GameClock.SystemTime_Milliseconds, TCP_Config.EventType.VERSION, Config.VersionNumber);

        //send subject ID
        SendSimpleJSONEvent(GameClock.SystemTime_Milliseconds, TCP_Config.EventType.SUBJECTID, ExperimentSettings.currentSubject.name);

        //NO LONGER REQUEST ALIGNMENT HERE. START IENUMERATOR WHEN TASK IS ACTUALLY STARTING
        //align clocks //SHOULD THIS BE FINISHED BEFORE WE START SENDING HEARTBEATS? -- NO
        //RequestClockAlignment();

        //start heartbeat
        StartHeartbeatPoll();

        //wait for "STARTED" message to be received
    }