Solved

TcpChannel Constructor (IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

Posted on 2006-11-02
2
592 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
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now