Show pageOld revisionsBacklinksExport to PDFBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== IPC Remoting ====== Example of using IPC remoting to send messages between processes: The code needs implementation of server availability checking to see if the server application is present and listening for messages (else the code crashes) **Project:** IPC_SharedInterfaces **Class:** ICommunicationService <code vbnet> Public Interface ICommunicationService Sub SaySomething(ByVal text As String) End Interface </code> **Project:** IPC_Server **Class:** CommunicationService <code vbnet> Public Class CommunicationService Inherits MarshalByRefObject Implements IPC_SharedInterfaces.ICommunicationService Public Sub SaySomething(ByVal text As String) Implements IPC_SharedInterfaces.ICommunicationService.SaySomething MsgBox(text) End Sub End Class </code> **Class:** Form1 <code vbnet> Imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imports System.Runtime.Remoting.Channels.Ipc Public Class Form1 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim ipcCh As IpcChannel ipcCh = New IpcChannel("MojProgramcic") ChannelServices.RegisterChannel(ipcCh, False) RemotingConfiguration.RegisterWellKnownServiceType( GetType(CommunicationService), "MojURI", WellKnownObjectMode.Singleton) End Sub End Class </code> **References:** IPC_SharedInterfaces, System.runtime.Remoting **Project:** IPC_Client **Class:** Form1 <code vbnet> Imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imports System.Runtime.Remoting.Channels.Ipc Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim ipcCh As New IpcChannel("MojKlijent") ChannelServices.RegisterChannel(ipcCh, False) Dim obj As IPC_SharedInterfaces.ICommunicationService = DirectCast(Activator.GetObject(GetType(IPC_SharedInterfaces.ICommunicationService), "ipc://MojProgramcic/MojURI"), IPC_SharedInterfaces.ICommunicationService) Try obj.SaySomething(Now.TimeOfDay.ToString) Catch err As System.Runtime.Remoting.ServerException MsgBox(err) End Try ChannelServices.UnregisterChannel(ipcCh) End Sub End Class </code> **References:** IPC_SharedInterfaces, System.runtime.Remoting development/net/ipc_remoting.txt Last modified: 2019/10/31 09:04by 127.0.0.1