[Mono-bugs] [Bug 60226][Nor] New - Remoting between Windows and Linux does not work when Windows is the Server
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 15 Jun 2004 15:33:07 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by clintp_bugzilla@geeksalad.org.
http://bugzilla.ximian.com/show_bug.cgi?id=60226
--- shadow/60226 2004-06-15 15:33:07.000000000 -0400
+++ shadow/60226.tmp.24420 2004-06-15 15:33:07.000000000 -0400
@@ -0,0 +1,156 @@
+Bug#: 60226
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details: Win32 = Win2k, Linux = Kernel 2.4.18 Debian
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: clintp_bugzilla@geeksalad.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Remoting between Windows and Linux does not work when Windows is the Server
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+This is identical in setup to bug 59835 except that the server is Windows,
+the Client is Linux. I did not test this configuration in 59835 because
+of firewalls. The error reported is:
+
+**** System.NullReferenceException - Object reference not set to an
+instance of an object.
+
+
+Steps to reproduce the problem:
+ ** These steps assume a Windows server, Linux Client **
+1. Compile this code to a DLL named ICalc.dll on the Windows system.
+
+using System;
+namespace MyServer
+{
+ public interface ICalc
+ {
+ double Add(double x, double y);
+ double Mult(double x, double y);
+ }
+
+}
+
+2. Move the DLL to the Linux system
+3. Compile this code on the Windows system, using the DLL in step 1 as a
+resource:
+
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Http;
+namespace MyServer
+{
+ 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();
+ }
+ }
+}
+
+
+4. Compile this code on the Linux system -- changing the IP address to
+the Windows server's -- using the DLL in step 1 as a resource:
+
+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://windows.server.ip.address: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;
+ }
+ }
+}
+
+5. Start the Windows server (you may want to verify that it is bound to
+port 65100)
+
+6. Start the Linux client, wait for error message.
+
+Actual Results:
+
+**** System.NullReferenceException - Object reference not set to an
+instance of an object.
+
+
+Expected Results:
+Sum: 7
+
+How often does this happen?
+Every time.
+
+Additional Information:
+I stumbled across this on a much different (and larger) example, but with
+identical results (NullReferenceException). In both cases the object
+returned at:
+
+ MyServer.ICalc calc = obj as MyServer.ICalc;
+
+Is not null, and is the right type.