예제 #1
0
        /// <summary>
        /// 代理端接收数据回调
        /// </summary>
        /// <param name="ar"></param>
        private void Proxy_Receive(IAsyncResult ar)
        {
            try
            {
                int Size = Proxy_Stream.EndRead(ar);

                if (Size > 0)
                {
                    Socks_Send(Client_Stream, Proxy_Data.Take(Size).ToArray());
                    Proxy_Stream.BeginRead(Proxy_Data, 0, Data_Size, P_Read_Delegate, null);
                }
                else
                {
                    close();
                }
            }
            catch {
                close();
            }
        }
예제 #2
0
 /// <summary>
 /// 代理端接收数据回调
 /// </summary>
 /// <param name="ar"></param>
 private void TCP_Proxy_Receive(IAsyncResult ar)
 {
     try
     {
         byte[] Data = DataHandle.En_Bytes(Proxy_Data.Take(Proxy_Stream.EndRead(ar)).ToArray());
         if (Data.Length > 0)
         {
             TCP_Socks_Send(Client_Stream, Data);
             Proxy_Stream.BeginRead(Proxy_Data, 0, Data_Size, TCP_Proxy_Receive, null);
         }
         else
         {
             close();
         }
     }
     catch
     {
         close();
     }
 }