Beispiel #1
0
 private void  SyncDataFromServer(IComChannel remoteObject)
 {
     try
     {
         m_CallerDirectory = remoteObject.GetClientDirectory();
         m_CallerExe       = remoteObject.GetCallingExe();
         m_Table           = remoteObject.GetTable();
         m_TestDllPath     = remoteObject.GetTestDllPath();
         Trace.WriteLine("data was queried successfully from server");
     }
     catch (Exception ex)
     {
         //we can recover from this error
         s_Logger.LogInfo("Could not retriev data from Sniper server" + ex.ToString());
     }
 }
Beispiel #2
0
        public void Listen()
        {
            try
            {
                AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
                if (s_AlreadyHooked == true)
                {
                    return;
                }
                s_AlreadyHooked = true;


                //Connect to server at port 60200 and get the port number at which to open service
                TcpClientChannel clientChannel = new TcpClientChannel("HitchHikerClient", null);
                ChannelServices.RegisterChannel(clientChannel, true);
                m_remoteObject = (IComChannel)Activator.GetObject(
                    typeof(IComChannel), "tcp://localhost:60200/HitchHiker.rem");
                if (m_remoteObject == null)
                {
                    s_Logger.LogError("Connection to HitchHiker server could not be established");
                }

                SyncDataFromServer(m_remoteObject);

                s_Logger.LogInfo("The port sent from server is " + m_Port.ToString(CultureInfo.CurrentCulture));

                //now start thread to listen to client
                object param = (object)m_Port;
                Thread clientListenerThread = new Thread(new ParameterizedThreadStart(StartClientServer));
                clientListenerThread.Start(param);

                s_Logger.LogInfo("Server has been started at client side");
            }
            catch (Exception e)
            {
            }
        }