blob: 29a8886a93efcbda572b0e54ff2bb582f120e47d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using Ch.Elca.Iiop;
using Ch.Elca.Iiop.Idl;
using Ch.Elca.Iiop.Services;
using System;
using System.IO;
public class ConsoleApp
{
public static void Main(string[] args)
{
if(args.Length != 1)
{
Console.WriteLine("Usage: client.exe server.ior");
return;
}
MappingConfiguration.Instance.UseBoxedInAny = false;
IDictionary props = new Hashtable();
IiopChannel channel = new IiopChannel(props);
ChannelServices.RegisterChannel(channel, false);
StreamReader sr = new StreamReader(args[0]);
string ior = sr.ReadLine();
Test test = (Test)RemotingServices.Connect(typeof(Test), ior);
object[] p = new object[2];
for(int i = 0; i < p.Length; ++i)
{
Container container;
Inner inner;
inner.value1 = 1 + i;
inner.value2 = 2 + i;
inner.value3 = 3 + i;
inner.value4 = 4 + i;
inner.value5 = 5 + i;
container.contents = inner;
p[i] = container;
}
try
{
p = test.RunTest(p);
for(int i = 0; i < p.Length; ++i)
{
if(p[i] is Container)
{
Inner inner = (Inner)((Container)p[i]).contents;
Console.WriteLine("[{0}]: {1} {2} {3} {4} {5}", i,
inner.value1, inner.value2, inner.value3, inner.value4, inner.value5);
}
}
test.shutdown ();
}
catch(Exception ex)
{
Console.WriteLine("Invoke failed: {0}", ex.ToString());
}
}
}
|