ICE 3.4.2
[php5-ice-freebsdport.git] / cs / test / Ice / checksum / server / Server.cs
blobbcbfc7155f5371c5b2c31b941024770195afd685
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;
13 public class Server
15 private static int run(string[] args, Ice.Communicator communicator)
17 communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
18 Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
19 Ice.Object @object = new Test.ChecksumI();
20 adapter.add(@object, communicator.stringToIdentity("test"));
21 adapter.activate();
22 communicator.waitForShutdown();
23 return 0;
26 public static int Main(string[] args)
28 int status = 0;
29 Ice.Communicator communicator = null;
31 #if !COMPACT
32 Debug.Listeners.Add(new ConsoleTraceListener());
33 #endif
35 try
37 communicator = Ice.Util.initialize(ref args);
38 status = run(args, communicator);
40 catch(System.Exception ex)
42 Console.Error.WriteLine(ex);
43 status = 1;
46 if(communicator != null)
48 try
50 communicator.destroy();
52 catch (Ice.LocalException ex)
54 Console.Error.WriteLine(ex);
55 status = 1;
59 return status;