private void Negotiate_ReadWhole_End(IAsyncResult ar) { Negotiation_SO asyncState = (Negotiation_SO)ar.AsyncState; try { asyncState.UpdateContext(); this.EndReadWhole(ar); AuthMethod method = this.ExtractAuthMethod(asyncState.Reply); if (((AuthMethod.NoAcceptable == method) && !asyncState.UseCredentials) && (base._proxyUser != null)) { asyncState.UseCredentials = true; byte[] buffer = this.PrepareNegotiationCmd(asyncState.UseCredentials); base.NStream.BeginWrite(buffer, 0, buffer.Length, new AsyncCallback(this.Negotiate_Write_End), asyncState); } else { this.BeginDoAuthentication(method, new AsyncCallback(this.Negotiate_DoAuth_End), asyncState); } } catch (Exception exception) { asyncState.Exception = exception; asyncState.SetCompleted(); } }
private void Negotiate_DoAuth_End(IAsyncResult ar) { Negotiation_SO asyncState = (Negotiation_SO)ar.AsyncState; try { asyncState.UpdateContext(); this.EndDoAuthentication(ar); } catch (Exception exception) { asyncState.Exception = exception; } asyncState.SetCompleted(); }
private void Negotiate_Write_End(IAsyncResult ar) { Negotiation_SO asyncState = (Negotiation_SO)ar.AsyncState; try { asyncState.UpdateContext(); base.NStream.EndWrite(ar); this.BeginReadWhole(asyncState.Reply, 0, 2, new AsyncCallback(this.Negotiate_ReadWhole_End), asyncState); } catch (Exception exception) { asyncState.Exception = exception; asyncState.SetCompleted(); } }