[Mono-devel-list] Problem with Remoting between Windows and Linux

Clinton A. Pierce clintp at geeksalad.org
Mon Jun 7 12:27:01 EDT 2004


Using MCS 0.95 and Mono 0.95 the following client/server pair works fine 
(shortened example from ORA's Programming C#) as long as the client and the 
server are on the same architecture.

Server Client
   Linux-Linux        OK
Win32-Win32 (2k) OK
   Linux-Win32       Fails
Win32-Linux         Cannot test, firewalls

The error that is thrown in the client is:
	"The object with ID 1 was referenced in a fixup but does not exist."

When running the client under Windows and the server under Linux.  The 
error occurs at the line:

	 double sum = calc.Add((double)3.0, (double)4.0);

Recommendations?


Server Code:

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
namespace MyServer
{The object with ID 1 was referenced in a fixup but does not exist.
        public class Calculator : MarshalByRefObject, ICalc
         {
                 public Calculator()
                 {
                         Console.WriteLine("Calculator Constructor...");
                 }
                 public double Add(double x, double y)
                 {
                         Console.WriteLine("Called add...");
                         return x + y;
                 }
                 public double Mult(double x, double y)
                 {
                         Console.WriteLine("Called mult...");
                         return x * y;
                }
         }
         public class ServerTest
         {
                 public static void Main()
                 {
                         HttpChannel chan = new HttpChannel(65100);
                         ChannelServices.RegisterChannel(chan);
                         Type calcType =
                                 Type.GetType("MyServer.Calculator");
                         RemotingConfiguration.RegisterWellKnownServiceType
                                 (calcType, "theEndPoint",
                                         WellKnownObjectMode.SingleCall);
                         Console.WriteLine("Press [enter] to exit...");
                         Console.ReadLine();
                 }
         }
}


Client Code:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
namespace MyServer
{
         class Class1
         {
                 [STAThread]
                 static void Main(string[] args)
                 {
                         HttpChannel chan = new HttpChannel(0);
                         ChannelServices.RegisterChannel(chan);
                         MarshalByRefObject obj = (MarshalByRefObject)
                                         RemotingServices.Connect(typeof(MyServer.ICalc),
                                                 "http://127.0.0.1:65100/theEndPoint");
                         try
                         {
                                 MyServer.ICalc calc = obj as MyServer.ICalc;
                                 double sum = calc.Add((double)3.0, 
(double)4.0);
                                 Console.WriteLine("Sum: " + sum.ToString());
                         }
                         catch (System.Exception ex)
                         {
                                 Console.WriteLine("Exception caught: \n" + 
ex.Message);
                         }
                         return;
                 }
         }
}

This code should be compiled to a DLL and used as a resource to both:
using System;
namespace MyServer
{
	public interface ICalc
	{
		double Add(double x, double y);
		double Mult(double x, double y);
	}

}




More information about the Mono-devel-list mailing list