Example #1
0
    private void ProcessReceive(SocketAsyncEventArgs e)
    {
        if (e.SocketError == SocketError.Success)
        {
            var socket = e.UserToken as Socket;

            var response = dataCollector.Collect(e.Buffer);

            if (response != null)
            {
                if (this.OnDataReceived != null)
                {
                    this.OnDataReceived(response);
                }
            }
            else
            {
                bool willRaiseEvent = socket.ReceiveAsync(clientArgs);
                if (!willRaiseEvent)
                {
                    ProcessReceive(e);
                }
            }
        }
        else
        {
            throw new SocketException((int)e.SocketError);
        }
    }
Example #2
0
        public void Execute(ref bool stop)
        {
            while (!stop)
            {
                _handler.PrepareNext();

                _scheduler.WaitNext(ref stop);

                if (!stop)
                {
                    _handler.Execute();

                    _collector.Collect();
                }
            }
        }
Example #3
0
 public void Configure()
 {
     context.Add(dataCollector.Collect());
     context.SaveChanges();
 }
 public async Task WhenICollectDataFilesForAnalysis()
 {
     await _collector.Collect();
 }