private static void InitRemoteCalculator() { WellKnownObjectMode objectMode; objectMode = WellKnownObjectMode.SingleCall; // Cada pedido é servido por um novo objecto //objectMode = WellKnownObjectMode.Singleton; // Todos os pedidos servidos pelo mesmo objecto IDictionary httpChannelProperties = new Hashtable(); httpChannelProperties["name"] = "calculatorHttpChannel"; httpChannelProperties["port"] = 2222; IDictionary tcpChannelProperties = new Hashtable(); tcpChannelProperties["name"] = "calculatorTcpChannel"; tcpChannelProperties["port"] = 3333; IDictionary ipcChannelProperties = new Hashtable(); ipcChannelProperties["name"] = "calculatorIpcChannel"; ipcChannelProperties["portName"] = "localhost:9090"; calculatorHttpChannel = new HttpChannel(httpChannelProperties, null, new SoapServerFormatterSinkProvider()); calculatorTcpChannel = new TcpChannel(tcpChannelProperties, null, new BinaryServerFormatterSinkProvider()); calculatorIpcChannel = new IpcChannel(ipcChannelProperties, null, new BinaryServerFormatterSinkProvider()); ChannelServices.RegisterChannel(calculatorHttpChannel, false); ChannelServices.RegisterChannel(calculatorTcpChannel, false); ChannelServices.RegisterChannel(calculatorIpcChannel, false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(RemoteCalculator), "RemoteCalculator", objectMode); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteServer"/> class. /// </summary> public RemoteServer() { RemoteObj = new RemoteObject(); serverchannel = new IpcChannel("localhost:15000"); ChannelServices.RegisterChannel(serverchannel, false); ref1 = RemotingServices.Marshal(RemoteObj, "RemoteObject.rem"); Console.WriteLine("ObjRef1 URI: " + ref1.URI); RemoteObj.ObjectSent += new ObjectSentEventHandler(OnObjectSent); }
internal DebugController(WorkflowRuntime serviceContainer, string hostName) { if (serviceContainer == null) { throw new ArgumentNullException("serviceContainer"); } try { this.programPublisher = new ProgramPublisher(); } catch { return; } this.serviceContainer = serviceContainer; this.programId = Guid.Empty; this.controllerConduit = null; this.channel = null; this.isZombie = false; this.hostName = hostName; AppDomain.CurrentDomain.ProcessExit += new EventHandler(this.OnDomainUnload); AppDomain.CurrentDomain.DomainUnload += new EventHandler(this.OnDomainUnload); this.serviceContainer.Started += new EventHandler<WorkflowRuntimeEventArgs>(this.Start); this.serviceContainer.Stopped += new EventHandler<WorkflowRuntimeEventArgs>(this.Stop); }
private static void InitRemoteMemory() { IDictionary httpChannelProperties = new Hashtable(); httpChannelProperties["name"] = "memoryHttpChannel"; httpChannelProperties["port"] = 4444; IDictionary tcpChannelProperties = new Hashtable(); tcpChannelProperties["name"] = "memoryTcpChannel"; tcpChannelProperties["port"] = 5555; IDictionary ipcChannelProperties = new Hashtable(); ipcChannelProperties["name"] = "memoryIpcChannel"; ipcChannelProperties["portName"] = "localhost:9191"; memoryHttpChannel = new HttpChannel(httpChannelProperties, null, new SoapServerFormatterSinkProvider()); memoryTcpChannel = new TcpChannel(tcpChannelProperties, null, new SoapServerFormatterSinkProvider()); memoryIpcChannel = new IpcChannel(ipcChannelProperties, null, new BinaryServerFormatterSinkProvider()); ChannelServices.RegisterChannel(memoryHttpChannel, false); ChannelServices.RegisterChannel(memoryTcpChannel, false); ChannelServices.RegisterChannel(memoryIpcChannel, false); RemotingConfiguration.ApplicationName = "RemoteMemory"; RemotingConfiguration.RegisterActivatedServiceType(typeof(RemoteMemory)); }
private static void setupRemotingServer() { if (_isInited) return; _isInited = true; IpcChannel channel = new IpcChannel(_ipcName); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(FlexCompilerShell), "FlexCompilerShell", WellKnownObjectMode.Singleton); }
//private static MessagePasser messagePasser; public static void ServerSetup(RecieveMessageDelegate del) { Messaging.del=del; IpcChannel serverChannel = new IpcChannel("localhost:9090"); ChannelServices.RegisterChannel(serverChannel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(MessagePasser), "MessagePasser.rem", WellKnownObjectMode.Singleton); }
static void TestIpcPerformance() { IpcChannel chan = new IpcChannel("Client"); ChannelServices.RegisterChannel(chan, false); MarketDataCenter center = (MarketDataCenter)Activator.GetObject( typeof(MarketDataCenter), "ipc://MarketDataIpcServer/RmdService"); const int kCount = 100000; TimeSpan sum = new TimeSpan(); Console.WriteLine("start..."); for (int i = 0; i < kCount; ++i) { Stopwatch sw = new Stopwatch(); sw.Start(); center.Echo(); //RawMarketData rmd = center.GetEchoData(); sw.Stop(); sum += sw.Elapsed; } Console.WriteLine(String.Format("IPC total ms = {0:n}", sum.TotalMilliseconds)); Console.WriteLine(String.Format("IPC avg ms = {0:n5}", (double)sum.TotalMilliseconds / kCount)); }
public void Bug609381 () { string portName = "ipc" + Guid.NewGuid ().ToString ("N"); string objUri = "ipcserver609381.rem"; string url = String.Format ("ipc://{0}/{1}", portName, objUri); IpcChannel serverChannel = new IpcChannel (portName); ChannelServices.RegisterChannel (serverChannel); RemotingServices.Marshal (new Server (), objUri); Server client = (Server) RemotingServices.Connect (typeof (Server), url); int count = 10 * 1024 * 1024; byte[] sendBuf = new byte[count]; sendBuf [sendBuf.Length - 1] = 41; byte[] recvBuf = client.Send (sendBuf); Assert.IsNotNull (recvBuf); Assert.AreNotSame (sendBuf, recvBuf); Assert.AreEqual (count, recvBuf.Length); Assert.AreEqual (42, recvBuf [recvBuf.Length - 1]); sendBuf = null; recvBuf = null; ChannelServices.UnregisterChannel (serverChannel); }
public static void LaunchInExistingInstance(string[] args) { IpcChannel channel = new IpcChannel(); ChannelServices.RegisterChannel(channel, false); string url = String.Format("ipc://{0}/{1}", ChannelName, SingleInstanceServiceName); // Register as client for remote object. WellKnownClientTypeEntry remoteType = new WellKnownClientTypeEntry(typeof(SingleInstanceHelper), url); RemotingConfiguration.RegisterWellKnownClientType(remoteType); // Create a message sink. string objectUri; IMessageSink messageSink = channel.CreateMessageSink(url, null, out objectUri); /* Console.WriteLine("The URI of the message sink is {0}.", objectUri); if (messageSink != null) { Console.WriteLine("The type of the message sink is {0}.", messageSink.GetType().ToString()); } */ SingleInstanceHelper helper = new SingleInstanceHelper(); helper.Run(args); }
/// <summary> /// Sets up the services remoting channel /// </summary> public void Start() { try { System.Collections.Hashtable props = new System.Collections.Hashtable(); props["typeFilterLevel"] = "Full"; // Both formatters only use the typeFilterLevel property BinaryClientFormatterSinkProvider cliFormatter = new BinaryClientFormatterSinkProvider(props, null); BinaryServerFormatterSinkProvider srvFormatter = new BinaryServerFormatterSinkProvider(props, null); // The channel requires these to be set that it can found by name by clients props["name"] = "SyslogConsole"; props["portName"] = "SyslogConsole"; props["authorizedGroup"] = "Everyone"; // Create the channel channel = new IpcChannel(props, cliFormatter, srvFormatter); channel.IsSecured = false; // Register the channel in the Windows IPC list ChannelServices.RegisterChannel(channel, false); // Register the channel for remoting use RemotingConfiguration.RegisterWellKnownServiceType(typeof(ClientMethods), "Server", WellKnownObjectMode.Singleton); // Assign the event to a handler Listener.MessageReceived += new Listener.MessageReceivedEventHandler(Listener_MessageReceived); } catch (Exception ex) { EventLogger.LogEvent("Could not create a named pipe because: " + ex.Message + Environment.NewLine + "Communication with the GUI console will be disabled.", System.Diagnostics.EventLogEntryType.Warning); } }
private static RemoteProxy GetRemoteProxy() { IpcChannel channel = new IpcChannel(); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownClientType(typeof(RemoteProxy), "ipc://svnmonitor/proxy"); return new RemoteProxy(); }
private void _init() { var physicalApplicationPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); physicalApplicationPath = Utl.NormalizeDir(Directory.GetParent(physicalApplicationPath).FullName); this.logFileName = physicalApplicationPath + "xlfrpt2_srvc.log"; this.log_msg("*************************************** Инициализация \"Очереди отчетов\"... ***************************************************"); this.log_msg("\tЗагрузка конфигурации..."); this._cfg = CConfigSys.load(physicalApplicationPath, this.logFileName); this._cfg.msgLogWriter = this.log_msg; this._cfg.errLogWriter = this.log_err; this.log_msg("\tКонфигурация загружена."); this.log_msg("\tИнициализация сервера Ipc..."); // Create the server channel. SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null); NTAccount account = sid.Translate(typeof(NTAccount)) as NTAccount; IDictionary channelProperties = new Hashtable(); channelProperties["portName"] = "Bio.Handlers.XLFRpt2.CQueueRemoteControl.Ipc"; channelProperties["exclusiveAddressUse"] = false; channelProperties["authorizedGroup"] = account.Value; channelProperties["typeFilterLevel"] = TypeFilterLevel.Full; IpcChannel serverChannel = new IpcChannel(channelProperties, null, null); ChannelServices.RegisterChannel(serverChannel, false); // Expose an object for remote calls. RemotingConfiguration.RegisterWellKnownServiceType( typeof(CQueueRemoteControl), "QueueRemoteControl.rem", WellKnownObjectMode.Singleton); this.log_msg("\tСервер Ipc инициализирован."); this.log_msg("*************************************** Инициализация \"Очереди отчетов\" выполнена. ***************************************************"); }
static void Main() { string[] arguments = Environment.GetCommandLineArgs(); string openHistory = arguments.FirstOrDefault((string s) => s.StartsWith("/openHistory:")); Guid historyGuid = Guid.Empty; if (openHistory != null) { historyGuid = new Guid(openHistory.Substring(openHistory.IndexOf(":") + 1)); List<Process> existingProcesses = new List<Process>(Process.GetProcessesByName("EasyConnect")); if (existingProcesses.Count == 0) existingProcesses.AddRange(Process.GetProcessesByName("EasyConnect.vshost")); if (existingProcesses.Count > 1) { IpcChannel ipcChannel = new IpcChannel("EasyConnectClient"); ChannelServices.RegisterChannel(ipcChannel, false); HistoryMethods historyMethods = (HistoryMethods)Activator.GetObject(typeof(HistoryMethods), "ipc://EasyConnect/HistoryMethods"); historyMethods.OpenToHistoryGuid(historyGuid); return; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mainForm = new MainForm() { OpenToHistory = historyGuid }; if (!mainForm.Closing) Application.Run(mainForm); }
public Manager() { InitializeComponent(); cbTargetProtocol.SelectedItem = 0; Utils.EnableDisablePanel(spltCtrlArchive.Panel2, false); var clientChannel = new IpcChannel(); ChannelServices.RegisterChannel(clientChannel, true); //- Setup the legal Utils.SetupRtfBox(rtbLicence, "license.rtf"); _serverLink = (IAPI)Activator.GetObject(typeof(IAPI), "ipc://localhost:19888/API"); try { ReloadJobList(); } catch (RemotingException) { MessageBox.Show(this, "Unable to communicate with the CloudBackup service. Please check that the service is running, close this window and try again", "Unable to access service", MessageBoxButtons.OK); btnNewArchive.Enabled = false; } }
public IPCServer(string serverURL) { System.Collections.IDictionary properties = new System.Collections.Hashtable(); properties["portName"] = serverURL; properties["exclusiveAddressUse"] = false; properties["name"] = Application.ProductName; _ipcServer = new IpcChannel(properties, null, null); }
/// <summary> /// Injectable Process /// </summary> /// <param name="pid">target PID</param> /// <param name="sleepInterval">how much time dll thread will sleep once when idle</param> public InjectableProcess(int pid, int sleepInterval = SLEEP_TIME) { _pid = pid; _interface = new InjectInterface(); SleepInterval = sleepInterval; //MARK:An IpcChannel that shall be keept alive until the server is not needed anymore. _channel = Util.IpcCreateServer(ref _channelName, WellKnownObjectMode.Singleton, _interface);//MARK:注意第三个参数 }
public static void TransmitMessage(string s) { IpcChannel channel = new IpcChannel(); ChannelServices.RegisterChannel(channel, false); WellKnownClientTypeEntry remoteType = new WellKnownClientTypeEntry(typeof(MessagePasser), "ipc://localhost:9090/MessagePasser.rem"); RemotingConfiguration.RegisterWellKnownClientType(remoteType); MessagePasser passer = new MessagePasser(); passer.SendMessage(s); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var channel = new IpcChannel("AgentRalphIpcChannel"); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(CloneFinderService), "CloneFinder", WellKnownObjectMode.Singleton); }
internal static void Start() { Logger.Log.Info("Starting remoting ipc-server..."); IpcChannel channel = new IpcChannel("svnmonitor"); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteProxy), "proxy", WellKnownObjectMode.SingleCall); Logger.Log.Info("Remoting ipc-server started."); RemoteProxy.Init(); }
public IpcCalculatorClient(string appUrl) : base(appUrl) { channel = new IpcChannel(); ChannelServices.RegisterChannel(channel, false); remoteCalculator = (IRemoteCalculator)Activator.GetObject( typeof(IRemoteCalculator), appUrl); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteClient"/> class. /// </summary> public RemoteClient() { clientchannel = new IpcChannel(); ChannelServices.RegisterChannel(clientchannel, false); RemotingConfiguration.RegisterWellKnownClientType(typeof(RemoteObject), "ipc://localhost:15000/RemoteObject.rem"); RemoteObj = new RemoteObject(); sponser = new RemoteClientSponser("RemoteClient"); lease = (ILease)RemoteObj.GetLifetimeService(); lease.Register(sponser); }
static void RegisterChannel(string name) { Hashtable properties = new Hashtable(); properties.Add("name", name); properties.Add("portName", name); properties.Add("typeFilterLevel", "Full"); IpcChannel channel = new IpcChannel(properties, new BinaryClientFormatterSinkProvider(properties, null), new BinaryServerFormatterSinkProvider(properties, null)); ChannelServices.RegisterChannel(channel,false); }
public void Start() { BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider {TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full}; BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider(); IpcChannel ipcCh = new IpcChannel(RemotingConfig.Config, clientProvider, serverProvider); ChannelServices.RegisterChannel(ipcCh, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof (ClientComms), RemotingConfig.ServerName, WellKnownObjectMode.Singleton); }
static Remoting() { if (_scribe == null) { _channel = new IpcChannel(); ChannelServices.RegisterChannel(_channel, false); _scribe = (IScribe)Activator.GetObject(typeof(IScribe), "ipc://CoAppTraceIpc/Scribe"); _scribe.Ping(); } }
private void Release() { if (_isMutexOwned) { _processSync.ReleaseMutex(); _isMutexOwned = false; ChannelServices.UnregisterChannel(_ipcChannel); _ipcChannel = null; ServerCommandHandler.Dispose(); } }
static void ActivateIpcService() { //select channel to communicate IpcChannel chan = new IpcChannel("MarketDataIpcServer"); //register channel ChannelServices.RegisterChannel(chan, false); //register remote object RemotingConfiguration.RegisterWellKnownServiceType( typeof(MarketDataCenter), "RmdService", WellKnownObjectMode.SingleCall); Console.WriteLine("Server Activated"); }
private static void Main() { string[] arguments = Environment.GetCommandLineArgs(); string openHistory = arguments.FirstOrDefault((string s) => s.StartsWith("/openHistory:")); string openBookmarks = arguments.FirstOrDefault((string s) => s.StartsWith("/openBookmarks:")); Guid historyGuid = Guid.Empty; Guid[] bookmarkGuids = null; // If a history GUID was passed in on the command line if (openHistory != null) { historyGuid = new Guid(openHistory.Substring(openHistory.IndexOf(":", StringComparison.Ordinal) + 1)); List<Process> existingProcesses = new List<Process>(Process.GetProcessesByName("EasyConnect")); if (existingProcesses.Count == 0) existingProcesses.AddRange(Process.GetProcessesByName("EasyConnect.vshost")); // If a process is already open, call the method in its IPC channel to tell it to open the given history entry and then exit this process if (existingProcesses.Count > 1) { IpcChannel ipcChannel = new IpcChannel("EasyConnectClient"); ChannelServices.RegisterChannel(ipcChannel, false); HistoryMethods historyMethods = (HistoryMethods) Activator.GetObject(typeof (HistoryMethods), "ipc://EasyConnect/HistoryMethods"); historyMethods.OpenToHistoryGuid(historyGuid); return; } } // If the user is trying to open bookmarks via the command line else if (openBookmarks != null) { string bookmarks = openBookmarks.Substring(openBookmarks.IndexOf(":", StringComparison.Ordinal) + 1); bookmarkGuids = (from bookmark in bookmarks.Split(',') where !String.IsNullOrEmpty(bookmark) select new Guid(bookmark)).ToArray(); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mainForm = new MainForm(bookmarkGuids) { OpenToHistory = historyGuid }; TitleBarTabsApplicationContext applicationContext = new TitleBarTabsApplicationContext(); applicationContext.Start(mainForm); Application.Run(applicationContext); }
public static RemoteControl Register (NoteManager manager) { #if ENABLE_DBUS BusG.Init (); RemoteControl remote_control = new RemoteControl (manager); Bus.Session.Register (Namespace, new ObjectPath (Path), remote_control); if (Bus.Session.RequestName (Namespace) != RequestNameReply.PrimaryOwner) return null; return remote_control; #else if (FirstInstance) { // Register an IPC channel for .NET remoting // access to our Remote Control IpcChannel = new IpcChannel (ServerName); ChannelServices.RegisterChannel (IpcChannel, false); RemotingConfiguration.RegisterWellKnownServiceType ( typeof (RemoteControlWrapper), WrapperName, WellKnownObjectMode.Singleton); // The actual Remote Control has many methods // that need to be called in the GTK+ mainloop, // which will not happen when the method calls // come from a .NET remoting client. So we wrap // the Remote Control in a class that implements // the same interface, but wraps most method // calls in Gtk.Application.Invoke. // // Note that only one RemoteControl is ever // created, and that it is stored statically // in the RemoteControlWrapper. RemoteControl realRemote = new RemoteControl (manager); RemoteControlWrapper.Initialize (realRemote); RemoteControlWrapper remoteWrapper = (RemoteControlWrapper) Activator.GetObject ( typeof (RemoteControlWrapper), ServiceUrl); return realRemote; } else { // If Tomboy is already running, register a // client IPC channel. IpcChannel = new IpcChannel (ClientName); ChannelServices.RegisterChannel (IpcChannel, false); return null; } #endif }
void CreateConnects() { BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider(); serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider(); Hashtable ipcProps = new Hashtable(); ipcProps["portName"] = "SysCAD.Service"; //ipcProps["typeFilterLevel"] = TypeFilterLevel.Full; IpcChannel ipcChannel = new IpcChannel(ipcProps, clientProv, serverProv); ChannelServices.RegisterChannel(ipcChannel, false); }
// Token: 0x06002EC1 RID: 11969 // RVA: 0x001302AC File Offset: 0x0012E4AC internal static void smethod_2() { if (Class784.ipcChannel_0 != null) { try { ChannelServices.UnregisterChannel(Class784.ipcChannel_0); } catch { } Class784.ipcChannel_0 = null; } }