Solved

TcpChannel Constructor (IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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