Remoting in C# and .NET - The Journal of Object Technology
Remoting in C# and .NET - The Journal of Object Technology
Remoting in C# and .NET - The Journal of Object Technology
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
REMOTING IN <strong>C#</strong> AND .<strong>NET</strong>}panel.MouseDown += new MouseEventH<strong>and</strong>ler( H<strong>and</strong>leMouseClick);HttpChannel channel = new HttpChannel();ChannelServices.RegisterChannel(channel);InitializeRemoteServer();server = new TargetServer();}}protected override void Dispose (bool dispos<strong>in</strong>g) {if (dispos<strong>in</strong>g) {if (components != null){components.Dispose();}}base.Dispose(dispos<strong>in</strong>g);}private void InitializeRemoteServer() {<strong>Remot<strong>in</strong>g</strong>Configuration.RegisterWellKnownClientType(type<strong>of</strong>(TargetServer),"http://localhost:12345/TargetServer");}private void H<strong>and</strong>leMouseClick(<strong>Object</strong> sender, MouseEventArgs e) {Graphics g = panel.CreateGraphics();g.DrawStr<strong>in</strong>g("X", Font, new SolidBrush(Color.Blue), e.X, e.Y);server.Record(e.X, e.Y);if (server.IsTargetHit(e.X, e.Y)) {g.DrawStr<strong>in</strong>g("H", Font, new SolidBrush(Color.Red),e.X, e.Y);hits++;} else {misses++;}hitsLbl.Text = "Hits: " + hits;missesLbl.Text = "Misses: " + misses;}private void InitializeComponent() {// Details not shown}[STAThread]static void Ma<strong>in</strong>() {Application.Run(new Client1());}92 JOURNAL OF OBJECT TECHNOLOGY VOL. 3, NO. 1