コード例 #1
0
        private void BeginAcceptCallback(IAsyncResult asyncResult)
        {
            if (_stop)
            {
                return;
            }

            try
            {
                Socket accepted = _listener.EndAccept(asyncResult);

                if (_stop)
                {
                    return;
                }

                SocketPongClient newClient = new SocketPongClient(accepted, _useTls, _readBufferSize, _certFile, _pvkFile, _pvkPassword);
                _connectedClients.Add(newClient);
                newClient.ExceptionOccurred += new ExceptionOccurredEventHandler(OnExceptionOccurred);
                newClient.Start();

                if (_stop)
                {
                    return;
                }

                _listener.BeginAccept(new AsyncCallback(BeginAcceptCallback), null);
            }
            catch (Exception ex)
            {
                OnExceptionOccurred(ex);
            }
        }
コード例 #2
0
ファイル: SocketHell.cs プロジェクト: Jakosa/MonoLibraries
		private void BeginAcceptCallback(IAsyncResult asyncResult)
		{
			if (_stop)
				return;

			try
			{
				Socket accepted = _listener.EndAccept(asyncResult);
				
				if (_stop)
					return;

				SocketPongClient newClient = new SocketPongClient(accepted, _useTls, _readBufferSize, _certFile, _pvkFile, _pvkPassword);
				_connectedClients.Add(newClient);
				newClient.ExceptionOccurred += new ExceptionOccurredEventHandler(OnExceptionOccurred);
				newClient.Start();

				if (_stop)
					return;

				_listener.BeginAccept(new AsyncCallback(BeginAcceptCallback), null);
			}
			catch (Exception ex)
			{
				OnExceptionOccurred(ex);
			}
		}