/// <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; } }
/// <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; } }
/// <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); }
/// <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; } }
/// <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; } }
public void Dispose() { SimulationServer.Unregister(this); }
public SimulationService() { callback = OperationContext.Current.GetCallbackChannel <ISimulationCallback>(); id = SimulationServer.Register(this, callback, out server); }
/// <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)); }