2 using System
.Threading
;
3 using System
.Runtime
.InteropServices
;
4 using System
.Runtime
.Remoting
;
5 using System
.Runtime
.Remoting
.Messaging
;
6 using System
.Runtime
.Remoting
.Proxies
;
7 using System
.Runtime
.Remoting
.Channels
;
8 using System
.Runtime
.Remoting
.Channels
.CORBA
;
13 // csc -r:../../lib/System.Runtime.Remoting.dll corba-example.cs
15 class Test
: MarshalByRefObject
{
17 public int test_function (int a
, bool b
)
19 Console
.WriteLine ("test function called: " + b
);
25 Test t1
= new Test ();
26 ObjRef myref
= RemotingServices
.Marshal (t1
, "/test");
27 Console
.WriteLine ("OBJREF: " + myref
.URI
);
29 string url
= "corba://localhost:8000/test";
32 CORBAChannel chnl
= new CORBAChannel (8000);
33 ChannelServices
.RegisterChannel (chnl
);
35 Console
.WriteLine ("Channel name: " + chnl
.ChannelName
);
36 Console
.WriteLine ("Channel priority: " + chnl
.ChannelPriority
);
37 Console
.WriteLine ("URI: " + chnl
.Parse (url
, out uri
));
38 Console
.WriteLine ("URI: " + uri
);
40 Test tp
= (Test
)RemotingServices
.Connect (typeof (Test
), url
);
42 int res
= tp
.test_function (4, true);
44 Console
.WriteLine ("RESULT: " + res
);
46 chnl
.StopListening (null);