コード例 #1
0
 static void OnServerConnectionAvailable(object sender, SecureConnectionResults args)
 {
     if (args.AsyncException != null)
     {
         _Log.ErrorFormat("Client connection failed {0}", args.AsyncException);
         return;
     }
     try
     {
         SslStream sslStream = args.SecureStream;
         Guid session = Guid.NewGuid();
         var receiveAgent = new ReceiveManager.ReceiveAgent(ClientRequestHelper.Process);
         var client = new Communication.Client(sslStream, session);
         var iClient = client as Trader.Helper.Common.ICommunicationAgent;
         iClient.DataArrived += ReceiveCenter.Default.DataArrivedHandler;
         iClient.Closed += AgentController.Default.SenderClosedEventHandle;
         var iReceiver = receiveAgent as Trader.Helper.Common.IReceiveAgent;
         iReceiver.ResponseSent += SendCenter.Default.ResponseSentHandle;
         AgentController.Default.Add(session, receiveAgent, client);
     }
     catch (Exception ex)
     {
         _Log.Error(ex);
     }
 }
コード例 #2
0
 static void OnServerConnectionAvailable(object sender, SecureConnectionResults args)
 {
     if (args.AsyncException != null)
     {
         _Log.ErrorFormat("Client connection failed {0}", args.AsyncException);
         return;
     }
     try
     {
         SslStream sslStream    = args.SecureStream;
         Guid      session      = Guid.NewGuid();
         var       receiveAgent = new ReceiveManager.ReceiveAgent(ClientRequestHelper.Process);
         var       client       = new Communication.Client(sslStream, session);
         var       iClient      = client as Trader.Helper.Common.ICommunicationAgent;
         iClient.DataArrived += ReceiveCenter.Default.DataArrivedHandler;
         iClient.Closed      += AgentController.Default.SenderClosedEventHandle;
         var iReceiver = receiveAgent as Trader.Helper.Common.IReceiveAgent;
         iReceiver.ResponseSent += SendCenter.Default.ResponseSentHandle;
         AgentController.Default.Add(session, receiveAgent, client);
     }
     catch (Exception ex)
     {
         _Log.Error(ex);
     }
 }