public IAsyncResult BeginAccept(AsyncCallback callback, object state)
 {
     if (this.CanUseAcceptEx)
     return this.BeginAccept(0, callback, state);
       if (Socket.s_LoggingEnabled)
     Logging.Enter(Logging.Sockets, (object) this, "BeginAccept", "");
       if (this.CleanedUp)
     throw new ObjectDisposedException(this.GetType().FullName);
       AcceptAsyncResult acceptAsyncResult = new AcceptAsyncResult((object) this, state, callback);
       acceptAsyncResult.StartPostingAsyncOp(false);
       this.DoBeginAccept((LazyAsyncResult) acceptAsyncResult);
       acceptAsyncResult.FinishPostingAsyncOp(ref this.Caches.AcceptClosureCache);
       if (Socket.s_LoggingEnabled)
     Logging.Exit(Logging.Sockets, (object) this, "BeginAccept", (object) acceptAsyncResult);
       return (IAsyncResult) acceptAsyncResult;
 }
Exemple #2
0
        public IAsyncResult BeginAccept(AsyncCallback callback, object state) {

#if !FEATURE_PAL
            if (CanUseAcceptEx)
            {
                return BeginAccept(0,callback,state);
            }
#endif
            if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "BeginAccept", "");
            if (CleanedUp) {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            // Set up the context flow.
            AcceptAsyncResult asyncResult = new AcceptAsyncResult(this, state, callback);
            asyncResult.StartPostingAsyncOp(false);

            // Do the accept.
            DoBeginAccept(asyncResult);

            // Set up for return.
            asyncResult.FinishPostingAsyncOp(ref Caches.AcceptClosureCache);

            if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "BeginAccept", asyncResult);
            return asyncResult;
        }
 public IAsyncResult BeginAccept(AsyncCallback callback, object state)
 {
     if (this.CanUseAcceptEx)
     {
         return this.BeginAccept(0, callback, state);
     }
     if (s_LoggingEnabled)
     {
         Logging.Enter(Logging.Sockets, this, "BeginAccept", "");
     }
     if (this.CleanedUp)
     {
         throw new ObjectDisposedException(base.GetType().FullName);
     }
     AcceptAsyncResult asyncResult = new AcceptAsyncResult(this, state, callback);
     asyncResult.StartPostingAsyncOp(false);
     this.DoBeginAccept(asyncResult);
     asyncResult.FinishPostingAsyncOp(ref this.Caches.AcceptClosureCache);
     if (s_LoggingEnabled)
     {
         Logging.Exit(Logging.Sockets, this, "BeginAccept", asyncResult);
     }
     return asyncResult;
 }