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


C# SocketClient.Dispose方法代码示例

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


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

示例1: StopInstance

        public static void StopInstance(SocketClient client)
        {
            Java.Lang.Process shellProcess = instances[client];
            instances.Remove(client);

            client.Shutdown();
            client.Dispose();
            shellProcess.Destroy();
        }
开发者ID:xxtbg,项目名称:coredroidservice,代码行数:9,代码来源:RuntimeHelper.cs

示例2: OnConnect

			/// <summary>
			/// Callback used to accept a connection on the server socket
			/// </summary>
			/// <param name="asyncResult">The result of the asynchronous operation</param>
			/// <remarks>
			/// <para>
			/// On connection adds to the list of connections 
			/// if there are two many open connections you will be disconnected
			/// </para>
			/// </remarks>
			private void OnConnect(IAsyncResult asyncResult)
			{
				try
				{
					// Block until a client connects
					Socket socket = m_serverSocket.EndAccept(asyncResult);

					LogLog.Debug(declaringType, "Accepting connection from ["+socket.RemoteEndPoint.ToString()+"]");
					SocketClient client = new SocketClient(socket);

					int currentActiveConnectionsCount = m_clients.Count;
					if (currentActiveConnectionsCount < MAX_CONNECTIONS) 
					{
						try
						{
							client.Send("TelnetAppender v1.0 (" + (currentActiveConnectionsCount + 1) + " active connections)\r\n\r\n");
							AddClient(client);
						}
						catch
						{
							client.Dispose();
						}
					}
					else 
					{
						client.Send("Sorry - Too many connections.\r\n");
						client.Dispose();
					}
				}
				catch
				{
				}
				finally
				{
					if (m_serverSocket != null)
					{
						m_serverSocket.BeginAccept(new AsyncCallback(OnConnect), null);
					}
				}
			}
开发者ID:Redi0,项目名称:meijing-ui,代码行数:50,代码来源:TelnetAppender.cs


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