A simple example of .net remoting

Remoting has 4 parts. Create Interface: To be used by Client and Remote Object Create Server: Is the actual remote object. Implements the interface Create Hosting Solution: This hosts the server on a specific protocol & port Create Client. Calls the remote object on the given protocol and port using the interface Create Interface (myInterface.dll): Create a Class Library project in Visual studio. And have the following class
Public Interface ICalculator
     Function Sum(ByVal n1 As Integer, ByVal n2 As
 Integer) As Integer
End Interface
Create Server (myServer.dll): New Class Library Project in Visual studio. Add reference of the myInterface.dll and System.Runtime.Remoting Add a class file and put the following code;
Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp
Imports myInterface
Public Class Calculations
   Inherits MarshalByRefObject
   Implements ICalculator
 Function Sum(ByVal no1 As Integer, ByVal no2 As Integer)
        As Integer Implements ICalculator.Sum
    Return (no1 + no2)
 End Function
End Class
Create Hosting Solution (myHost.exe): New console Project in Visual studio. Add reference to myServer.dll and System.Runtime.Remoting Add a class file and put the following code;
Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp

Public Class Server
 Shared Sub Main()
   Try
    ChannelServices.RegisterChannel(New TcpChannel(9999))
    RemotingConfiguration.RegisterWellKnownServiceType( _
         GetType(Calculations), "RemoteCalcObj", _
  WellKnownObjectMode.Singleton)
   Catch ex As Exception
     Console.WriteLine(ex.InnerException)
   End Try
   Console.WriteLine("The Server started on port 9999")
   Console.WriteLine("Press Enter to stop the server")
   Console.ReadLine()

 End Sub
End Class
How to locate open and used ports
Create Client (myClient.exe): New console Project in Visual studio. Add reference to myInterface.dll and System.Runtime.Remoting Add a class file and put the following code;
Imports System.Runtime.Remoting
Imports myInterface

Private Sub CallRemoteObject()
 Dim obj As ICalculator
 Dim sum As Integer
 Try
  obj = CType(Activator.GetObject(GetType(ICalculator),_
        "tcp://localhost:9999/RemoteCalcObj"), ICalculator)
  sum = obj.Sum(5, 10)
 Catch ex As Exception
  Console.WriteLine(ex.Message)
 End Try
End Sub
Additional Resources: How to locate open and used ports