System.Net.WebConnection.Close C# (CSharp) Method

Close() private method

private Close ( bool sendNext ) : void
sendNext bool
return void
		internal void Close (bool sendNext)
		{
			lock (this) {
				if (nstream != null) {
					try {
						nstream.Close ();
					} catch {}
					nstream = null;
				}

				if (socket != null) {
					try {
						socket.Close ();
					} catch {}
					socket = null;
				}

				if (ntlm_authenticated)
					ResetNtlm ();
				busy = false;
				Data = new WebConnectionData ();
				if (sendNext)
					SendNext ();
			}
		}

Usage Example

Esempio n. 1
0
        public override int Read(byte [] buffer, int offset, int size)
        {
            if (!isRead)
            {
                throw new NotSupportedException("this stream does not allow reading");
            }

            if (totalRead >= contentLength)
            {
                return(0);
            }

            AsyncCallback  cb  = new AsyncCallback(ReadCallbackWrapper);
            WebAsyncResult res = (WebAsyncResult)BeginRead(buffer, offset, size, cb, null);

            if (!res.IsCompleted && !res.WaitUntilComplete(request.ReadWriteTimeout, false))
            {
                nextReadCalled = true;
                cnc.Close(true);
                throw new WebException("The operation has timed out.",
                                       WebExceptionStatus.Timeout);
            }

            return(EndRead(res));
        }
All Usage Examples Of System.Net.WebConnection::Close