Solved

TcpChannel Constructor (IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

Posted on 2006-11-02
2
596 Views
Last Modified: 2008-02-01
TcpChannel Constructor (IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

can someone give or find me a coded example of this please?

i need to make a TcpChannel using this specific constructor
0
Comment
Question by:joshuadavidlee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Expert Comment

by:sabeesh
ID: 17857119
0
 
LVL 9

Accepted Solution

by:
WinterMuteUK earned 500 total points
ID: 17858001
I use this code to help me:

Cheers

Wint.

/// <summary>Create a new TcpChannel to be registered on a given port.</summary>
/// <param name="port">The port to register the channel on, use '0' (zero) for a client.</param>
/// <returns>The IChannel instance created, it's important to keep this if you
/// plan on unregistering the channel at a later date.</returns>
public static IChannel CreateChannel(int port)
{
    //Change this mode to prevent (off) / allow (on) / allow remote only (RemoteOnly)
    //exceptions being propogated to your clients. i.e. if the server throws an exception
    //and this is set to 'off' the client will receive a generic remoting exception. If this
    //is set to 'on' the client will recieve the whole exception.
    RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.On;

    BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
    serverProv.TypeFilterLevel = TypeFilterLevel.Full;

    BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();

    IDictionary props = new Hashtable();
    props["port"] = port;
    if (ChannelServices.RegisteredChannels.Length > 0)
        props["name"] = String.Empty;    

    IChannel channel = new TcpChannel(props, clientProv, serverProv);
    ChannelServices.RegisterChannel(channel);

    return channel;
}
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question