|
using System;
using mycomponent;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
namespace Server
{
class Class1
{
static void Main(string[] args)
{
TcpChannel m_TcpChan = new TcpChannel(9999);
ChannelServices.RegisterChannel(m_TcpChan);
Type theType = new ServerClass().GetType();
RemotingConfiguration.RegisterWellKnownServiceType(
theType,
"FirstRemote",
WellKnownObjectMode.Singleton);
System.Console.WriteLine("Press ENTER to quit");
System.Console.ReadLine();
}
}
public class ServerClass : AbstractServer
{
public override string myfunc(string what)
{
Console.WriteLine("in myfunc");
FireNewBroadcastedMessageEvent("Event: " + what + " was said");
return "Take " + what;
}
public event myeventhandler myHandler;
public override event myeventhandler myevent
{
add
{
Console.WriteLine("in event myevent + add");
myHandler = value;
}
remove
{
Console.WriteLine("in event myevent + remove");
}
}
protected void FireNewBroadcastedMessageEvent(string text)
{
Console.WriteLine("Broadcasting...");
myHandler("hai");
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.