Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Professional C#, 2nd and 3rd Editions
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Professional C#, 2nd and 3rd Editions
This is the forum to discuss the Wrox book Professional C#, 3rd Edition by Simon Robinson, Christian Nagel, Karli Watson, Jay Glynn, Morgan Skinner, Bill Evjen; ISBN: 9780764557590
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C#, 2nd and 3rd Editions section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 25th, 2006, 01:30 PM
Registered User
Join Date: Jan 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default RegisterChannel on the client (.NET Remoting)

Hi. I'm working through the .NET Remoting chapter of the book, and I have a question. Any help would be appreciated. The following code (taken from the downloaded source code) is from the HelloClient.cs file (I deleted a few commented lines):

using System;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Channels.Http;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Lifetime;

namespace Wrox.ProCSharp.Remoting
   public class HelloClient
      public static void Main(string[] args)
         ChannelServices.RegisterChannel(new TcpChannel());
         object[] attrs =
            {new UrlAttribute("tcp://localhost:8086/Hello") };
      Hello obj = (Hello)Activator.CreateInstance(typeof(Hello),
               null, attrs);

    ILease lease = (ILease)obj.GetLifetimeService();
    if (lease != null)
        Console.WriteLine("Lease Configuration:");
        Console.WriteLine("InitialLeaseTime: " +
        Console.WriteLine("RenewOnCallTime: " +
        Console.WriteLine("SponsorshipTimeout: " +

    MySerialized ser = obj.GetMySerialized();
    if (!RemotingServices.IsTransparentProxy(ser))
       Console.WriteLine("ser is not a transparent proxy");
    MyRemote rem = obj.GetMyRemote();
    if (RemotingServices.IsTransparentProxy(rem))
        Console.WriteLine("rem is a transparent proxy");



I executed the sample and everything worked as expected, the server was active, the remote methods were called. So my question is: what's the need for the following line:

      ChannelServices.RegisterChannel(new TcpChannel());

I tried commenting it and everything worked exctly the same way! I see a need for registering a channel for the TCP client but no handle to it seems to be given by the previous code. Can anyone explain this to me?

Thanks in advance,
Miguel Barrosa

  #2 (permalink)  
Old January 25th, 2006, 01:37 PM
Registered User
Join Date: Jan 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Sorry, I forgot to mention this. The previous post refers to the 3rd edition of the book.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET Remoting premalm ASP.NET 2.0 Professional 3 August 5th, 2008 02:31 PM
.NET Remoting Client... babloo81 BOOK: Professional C#, 2nd and 3rd Editions 0 January 31st, 2006 02:31 AM
.NET Remoting application in vb.net Tek4VB .NET Web Services 6 November 19th, 2003 09:59 AM
Remoting (.Net) Indian Ocean .NET Web Services 6 November 12th, 2003 03:27 PM
.NET Enterprise Development in VB.NET Remoting burkert All Other Wrox Books 0 June 24th, 2003 09:04 AM

All times are GMT -4. The time now is 04:43 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.