当前位置: 首页>>代码示例>>C#>>正文


C# HttpConnection.BeginReadRequest方法代码示例

本文整理汇总了C#中HttpConnection.BeginReadRequest方法的典型用法代码示例。如果您正苦于以下问题:C# HttpConnection.BeginReadRequest方法的具体用法?C# HttpConnection.BeginReadRequest怎么用?C# HttpConnection.BeginReadRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpConnection的用法示例。


在下文中一共展示了HttpConnection.BeginReadRequest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: processAccepted

    private static void processAccepted (Socket socket, EndPointListener listener)
    {
      HttpConnection conn = null;
      try {
        conn = new HttpConnection (socket, listener);
        lock (listener._unregisteredSync)
          listener._unregistered[conn] = conn;

        conn.BeginReadRequest ();
      }
      catch {
        if (conn != null) {
          conn.Close (true);
          return;
        }

        socket.Close ();
      }
    }
开发者ID:yakolla,项目名称:HelloVertX,代码行数:19,代码来源:EndPointListener.cs

示例2: OnAccept

		static void OnAccept (IAsyncResult ares)
		{
			EndPointListener epl = (EndPointListener) ares.AsyncState;
			Socket accepted = null;
			try {
				accepted = epl.sock.EndAccept (ares);
			} catch {
				// Anything to do here?
			} finally {
				try {
					epl.sock.BeginAccept (OnAccept, epl);
				} catch {
					if (accepted != null) {
						try {
							accepted.Close ();
						} catch {}
						accepted = null;
					}
				} 
			}

			if (accepted == null)
				return;

			if (epl.secure && (epl.key == null)) {
				accepted.Close ();
				return;
			}
			HttpConnection conn = new HttpConnection (accepted, epl);
			conn.BeginReadRequest ();
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:31,代码来源:EndPointListener.cs

示例3: OnAccept

		static void OnAccept (object sender, EventArgs e)
		{
			SocketAsyncEventArgs args = (SocketAsyncEventArgs) e;
			EndPointListener epl = (EndPointListener) args.UserToken;
			Socket accepted = null;
			if (args.SocketError == SocketError.Success) {
				accepted = args.AcceptSocket;
				args.AcceptSocket = null;
			}

			try {
				if (epl.sock != null)
					epl.sock.AcceptAsync (args);
			} catch {
				if (accepted != null) {
					try {
						accepted.Close ();
					} catch {}
					accepted = null;
				}
			} 

			if (accepted == null)
				return;

			if (epl.secure && (epl.cert == null || epl.key == null)) {
				accepted.Close ();
				return;
			}
			HttpConnection conn = new HttpConnection (accepted, epl, epl.secure, epl.cert, epl.key);
			lock (epl.unregistered) {
				epl.unregistered [conn] = conn;
			}
			conn.BeginReadRequest ();
		}
开发者ID:transformersprimeabcxyz,项目名称:mono.net.httplistener,代码行数:35,代码来源:EndPointListener.cs

示例4: onAccept

    private static void onAccept (object sender, EventArgs e)
    {
      var args = (SocketAsyncEventArgs) e;
      var listener = (EndPointListener) args.UserToken;
      Socket accepted = null;
      if (args.SocketError == SocketError.Success) {
        accepted = args.AcceptSocket;
        args.AcceptSocket = null;
      }

      try {
        listener._socket.AcceptAsync (args);
      }
      catch {
        if (accepted != null)
          accepted.Close ();

        return;
      }

      if (accepted == null)
        return;

      HttpConnection conn = null;
      try {
        conn = new HttpConnection (accepted, listener);
        lock (((ICollection) listener._unregistered).SyncRoot)
          listener._unregistered [conn] = conn;

        conn.BeginReadRequest ();
      }
      catch {
        if (conn != null) {
          conn.Close (true);
          return;
        }

        accepted.Close ();
      }
    }
开发者ID:hdczsf,项目名称:websocket-sharp,代码行数:40,代码来源:EndPointListener.cs

示例5: ProcessAccept

        private void ProcessAccept(Socket accepted)
        {
            try
            {
                var listener = this;

                if (listener.secure && listener.cert == null)
                {
                    accepted.Close();
                    return;
                }

                var connectionId = Guid.NewGuid().ToString("N");

                HttpConnection conn = new HttpConnection(_logger, accepted, listener, listener.secure, listener.cert, connectionId);
                //_logger.Debug("Adding unregistered connection to {0}. Id: {1}", accepted.RemoteEndPoint, connectionId);
                lock (listener.unregistered)
                {
                    listener.unregistered[conn] = conn;
                }
                conn.BeginReadRequest();
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error in ProcessAccept", ex);
            }
        }
开发者ID:tekhedd,项目名称:SocketHttpListener,代码行数:27,代码来源:EndPointListener.cs

示例6: ProcessAccept

        private static void ProcessAccept(SocketAsyncEventArgs args)
        {
            Socket accepted = null;
            if (args.SocketError == SocketError.Success)
                accepted = args.AcceptSocket;

            var epl = (EndPointListener) args.UserToken;

            Accept(epl._sock, args, ref accepted);
            if (accepted == null)
                return;

            if (epl._secure && epl._cert == null)
            {
                accepted.Dispose();
                return;
            }
            var conn = new HttpConnection(accepted, epl, epl._secure, epl._cert);
            lock (epl._unregistered)
            {
                epl._unregistered[conn] = conn;
            }
            conn.BeginReadRequest();
        }
开发者ID:unosquare,项目名称:embedio,代码行数:24,代码来源:EndPointListener.cs


注:本文中的HttpConnection.BeginReadRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。