Exemplo n.º 1
0
        private async void StartAccepting(HttpListenerContext context)
        {
            do             // TODO: add the appropriate try/catch here, utilize User
            {
                try
                {
                    var socketContext = await context.AcceptWebSocketAsync(null);

                    if (socketContext != null && !_disposed)
                    {
                        var child = new WebSocketTransportSource(socketContext.WebSocket);
                        child.Received += OnChildReceived;
                        _cache[socketContext.WebSocket] = child;
                    }
                }
                catch (IndexOutOfRangeException)
                {
                    // no idea what is causing this
                    break;
                }
            } while (_listener.IsListening && !_disposed);
        }
		private async void StartAccepting(HttpListenerContext context)
		{
			do // TODO: add the appropriate try/catch here, utilize User
			{
				try
				{
					var socketContext = await context.AcceptWebSocketAsync(null);
					if (socketContext != null && !_disposed)
					{
						var child = new WebSocketTransportSource(socketContext.WebSocket);
						child.Received += OnChildReceived;
						_cache[socketContext.WebSocket] = child;
					}
				}
				catch (IndexOutOfRangeException)
				{
					// no idea what is causing this
					break;
				}

			} while (_listener.IsListening && !_disposed);
		}