Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:30:04+00:00 2026-05-28T14:30:04+00:00

using System; using System.Collections; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; using System.Runtime.Remoting; namespace ConsoleApplication1 { class

  • 0
using System;
using System.Collections;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("press any key plus enter to create server: ");
            if (Console.ReadLine().Length > 0)
            {
                var serverProv = new BinaryServerFormatterSinkProvider();
                serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                IDictionary props = new Hashtable();
                props["port"] = 17017;
                props["name"] = "tcp server";
                var channel = new TcpChannel(props, null, serverProv);
                ChannelServices.RegisterChannel(channel, false);

                RemotingConfiguration.RegisterWellKnownServiceType(typeof(Server), "server",
                                                                   WellKnownObjectMode.Singleton);
                Console.WriteLine("Server created");
            }
            else
            {
                ChannelServices.RegisterChannel(new TcpChannel(), false);
                Server server = (Server)Activator.GetObject(typeof(Server), "tcp://localhost:17017/server");
                Client client = new Client();
                client.Connect(server);
            }
            Console.ReadLine();
        }
    }

    class Server : MarshalByRefObject
    {
        //private List<Client> cilents = new List<Client>();

        public event EventHandler ClientedAdded;

        public void AddClient(Client client)
        {
            if (ClientedAdded != null)
            {
                foreach (EventHandler handler in ClientedAdded.GetInvocationList())
                {
                    handler.BeginInvoke(this, EventArgs.Empty, null, null);
                }
            }
        }
    }

    class Client : MarshalByRefObject
    {
        public void Connect(Server server)
        {
            server.ClientedAdded += server_ClientedAdded;

            server.AddClient(this);
        }

        void server_ClientedAdded(object sender, EventArgs e)
        {
            Console.WriteLine("server_ClientedAdded");
        }
    }
}

First, run the exe and create a server. Then run the exe and create a client by pressing Enter directly.

The exception will be thrown at handler.BeginInvoke(this, EventArgs.Empty, null, null);.

This remoting proxy has no channel sink which means either the server
has no registered server channels that are listening, or this
application has no suitable client channel to talk to the server.

So how to fix it?

I found a similar question on http://www.codeguru.com/forum/showthread.php?t=420124. The author provided a solution but it is too brief for me to understand.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:30:05+00:00Added an answer on May 28, 2026 at 2:30 pm

    I solved it!

    Just try using

    handler(this, EventArgs.Empty)
    

    rather than

    handler.BeginInvoke(this, EventArgs.Empty, null, null); 
    

    I got an exception saying can not call a private method.

    Then the problem is clear and I make server_ClientedAdded public.

    Now the code works!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GenericCount { class Program {
I have this class: using System; using System.Collections.Generic; using System.Runtime.Serialization; namespace Grouping { [Serializable]
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Caching; namespace ConsoleApplication4 { class
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace ConsoleApplication1 { public
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace EfTestFactory { public abstract class
I have this code (C#): using System.Collections.Generic; namespace ConsoleApplication1 { public struct Thing {
This is my Hello World Remoting App. using System; using System.Collections.Generic; using System.Text; namespace
I'm having a class like the following: using System; using System.Collections.Generic; using System.Runtime.Serialization; [DataContract()]
Consider the following snippet: using System; using System.Collections.Generic; using System.Linq; using System.Net; namespace ForumLogins
I have an interface that contains a single method called ListAll() using System.Collections.Generic; namespace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.