示例#1
0
 /// <summary>
 ///   Client connected handler
 /// </summary>
 /// <param name="iar"> The IAsyncResult </param>
 private void OnClientConnect(IAsyncResult iar)
 {
     try
     {
         Socket      socket     = Listener.EndAccept(iar);
         byte[]      ivRecv     = { 70, 114, 122, 82 };
         byte[]      ivSend     = { 82, 48, 120, 115 };
         MapleCrypto recvCrypto = new MapleCrypto(ivRecv);
         MapleCrypto sendCrypto = new MapleCrypto(ivSend);
         Session     session    = new Session(socket, recvCrypto, sendCrypto);
         session.Begin(ivRecv, ivSend);
         Listener.BeginAccept(OnClientConnect, null);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine(e.StackTrace);
     }
 }
示例#2
0
 /// <summary>
 ///   Client connected handler
 /// </summary>
 /// <param name="iar"> The IAsyncResult </param>
 private void OnClientConnect(IAsyncResult iar)
 {
     try
     {
         Socket socket = Listener.EndAccept(iar);
         byte[] ivRecv = {70, 114, 122, 82};
         byte[] ivSend = {82, 48, 120, 115};
         MapleCrypto recvCrypto = new MapleCrypto(ivRecv);
         MapleCrypto sendCrypto = new MapleCrypto(ivSend);
         Session session = new Session(socket, recvCrypto, sendCrypto);
         session.Begin(ivRecv, ivSend);
         Listener.BeginAccept(OnClientConnect, null);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine(e.StackTrace);
     }
 }