Solved

TcpChannel Constructor (IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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