ICE 3.4.2
[php5-ice-freebsdport.git] / cs / test / Ice / seqMapping / Server.cs
blob82a0d342718e1f84ad699d4e7d16725aed073ffc
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
10 using System;
11 using System.Diagnostics;
12 using System.Reflection;
14 [assembly: CLSCompliant(true)]
16 [assembly: AssemblyTitle("IceTest")]
17 [assembly: AssemblyDescription("Ice test")]
18 [assembly: AssemblyCompany("ZeroC, Inc.")]
20 public class Server
22 private static int run(string[] args, Ice.Communicator communicator)
24 communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
25 Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
26 adapter.add(new MyClassI(), communicator.stringToIdentity("test"));
27 adapter.activate();
29 communicator.waitForShutdown();
30 return 0;
33 public static int Main(string[] args)
35 int status = 0;
36 Ice.Communicator communicator = null;
38 #if !COMPACT
39 Debug.Listeners.Add(new ConsoleTraceListener());
40 #endif
42 try
44 Ice.InitializationData data = new Ice.InitializationData();
45 #if COMPACT
47 // When using Ice for .NET Compact Framework, we need to specify
48 // the assembly so that Ice can locate classes and exceptions.
50 data.properties = Ice.Util.createProperties();
51 data.properties.setProperty("Ice.FactoryAssemblies", "server");
52 #endif
53 communicator = Ice.Util.initialize(ref args, data);
54 status = run(args, communicator);
56 catch(System.Exception ex)
58 Console.Error.WriteLine(ex);
59 status = 1;
62 if(communicator != null)
64 try
66 communicator.destroy();
68 catch(Ice.LocalException ex)
70 Console.Error.WriteLine(ex);
71 status = 1;
75 return status;