コード例 #1
0
ファイル: UnmanagedSocket.cs プロジェクト: stormdust/xsp
        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);
        }
コード例 #2
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;
		}