Esempio n. 1
0
        /// <summary>
        /// Starts to listen for new connections.
        /// </summary>
        /// <param name = "extensionPaths" > List of pathes to search for Extensions</param>
        /// <param name="pipeName">name of NamedPipe or null, if disabled</param>
        /// <param name="port">TCP Port to listen for new connection or 0, if disabled</param>
        public static void Start(string[] extensionPaths, string pipeName, int port)
        {
            if (instance != null)
            {
                throw new Exception("Server is already running");
            }

            instance = new SimulationServer(extensionPaths, pipeName, port);
            try
            {
                instance.Open();
            }
            catch (Exception)
            {
                instance = null;
                throw;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Stops running server.
        /// </summary>
        public static void Stop()
        {
            if (instance == null)
            {
                throw new Exception("There is no running server");
            }

            try
            {
                instance.Close();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                instance = null;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Registers a new Client at the server Instance.
        /// </summary>
        /// <param name="service">Reference to the service</param>
        /// <param name="callback">Reference to the callback</param>
        /// <param name="server">output Parameter for the server Reference</param>
        /// <returns>New Id for this client.</returns>
        internal static int Register(ISimulationService service, ISimulationCallback callback, out SimulationServer server)
        {
            if (instance == null)
                throw new Exception("Server is not running");

            server = instance;
            return instance.RegisterClient(service, callback);
        }
Esempio n. 4
0
        /// <summary>
        /// Stops running server.
        /// </summary>
        public static void Stop()
        {
            if (instance == null)
                throw new Exception("There is no running server");

            try
            {
                instance.Close();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                instance = null;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Starts to listen for new connections.
        /// </summary>
        /// <param name = "extensionPaths" > List of pathes to search for Extensions</param>
        /// <param name="pipeName">name of NamedPipe or null, if disabled</param>
        /// <param name="port">TCP Port to listen for new connection or 0, if disabled</param>
        public static void Start(string[] extensionPaths, string pipeName, int port)
        {
            if (instance != null)
                throw new Exception("Server is already running");

            instance = new SimulationServer(extensionPaths, pipeName, port);
            try
            {
                instance.Open();
            }
            catch (Exception)
            {
                instance = null;
                throw;
            }
        }
Esempio n. 6
0
 public void Dispose()
 {
     SimulationServer.Unregister(this);
 }
Esempio n. 7
0
 public SimulationService()
 {
     callback = OperationContext.Current.GetCallbackChannel <ISimulationCallback>();
     id       = SimulationServer.Register(this, callback, out server);
 }
Esempio n. 8
0
        /// <summary>
        /// Registers a new Client at the server Instance.
        /// </summary>
        /// <param name="service">Reference to the service</param>
        /// <param name="callback">Reference to the callback</param>
        /// <param name="server">output Parameter for the server Reference</param>
        /// <returns>New Id for this client.</returns>
        internal static int Register(ISimulationService service, ISimulationCallback callback, out SimulationServer server)
        {
            if (instance == null)
            {
                throw new Exception("Server is not running");
            }

            server = instance;
            return(instance.RegisterClient(service, callback));
        }