Solved

TcpChannel Constructor (IDictionary, IClientChannelSinkProvider, IServerChannelSinkProvider)

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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

617 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