Moving micasa 1.5 trunk to Novell forge.
This commit is contained in:
65
c_sharp/NSSCSWrapper/RemoteServer.cs
Normal file
65
c_sharp/NSSCSWrapper/RemoteServer.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Runtime.Remoting.Channels;
|
||||
using System.Runtime.Remoting.Channels.Tcp;
|
||||
|
||||
namespace Novell.CASA
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for RemoteServer.
|
||||
/// </summary>
|
||||
public class RemoteServer
|
||||
{
|
||||
|
||||
|
||||
TcpChannel channel;
|
||||
public RemoteServer()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
public void startServer(int port)
|
||||
{
|
||||
int iPort = port;
|
||||
if (iPort == 0)
|
||||
iPort = 8080;
|
||||
|
||||
channel = new TcpChannel(iPort);
|
||||
|
||||
try
|
||||
{
|
||||
ChannelServices.RegisterChannel(channel);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Register as an available service with the name HelloWorld
|
||||
RemotingConfiguration.RegisterWellKnownServiceType(
|
||||
typeof(SecretStore),
|
||||
"enumerateSecretIDs",
|
||||
WellKnownObjectMode.SingleCall );
|
||||
|
||||
RemotingConfiguration.RegisterWellKnownServiceType(
|
||||
typeof(SecretStore),
|
||||
"getSecret(string id)",
|
||||
WellKnownObjectMode.SingleCall );
|
||||
|
||||
System.Console.WriteLine("Server Started on "+ iPort);
|
||||
// System.Console.ReadLine();
|
||||
//return 0;
|
||||
}
|
||||
|
||||
public void stopServer()
|
||||
{
|
||||
if (channel != null)
|
||||
{
|
||||
System.Console.WriteLine("Stopping server");
|
||||
ChannelServices.UnregisterChannel(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user