示例#1
0
        public override Socket EndAccept(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            SockAccept s = asyncResult as SockAccept;

            if (s == null || s.socket != socket)
            {
                throw new ArgumentException(
                          "Result was not produced by current instance.",
                          "asyncResult");
            }

            if (!s.IsCompleted)
            {
                s.AsyncWaitHandle.WaitOne();
            }

            if (s.except != null)
            {
                throw s.except;
            }

            UnmanagedSocket u = new UnmanagedSocket(s.accepted);

            u.connected = true;
            return(u);
        }
		public override Socket EndAccept (IAsyncResult asyncResult)
		{
			if (asyncResult == null)
				throw new ArgumentNullException ("asyncResult");
			
			SockAccept s = asyncResult as SockAccept;
			if (s == null || s.socket != socket)
				throw new ArgumentException (
					"Result was not produced by current instance.",
					"asyncResult");
			
			if (!s.IsCompleted)
				s.AsyncWaitHandle.WaitOne ();
			
			if (s.except != null)
				throw s.except;
			
			UnmanagedSocket u = new UnmanagedSocket (s.accepted);
			u.connected = true;
			return u;
		}