Question

I have a server object as

 TcpChannel tcp = new TcpChannel(1234);
        ChannelServices.RegisterChannel(tcp, false);
        string s = ConfigurationManager.AppSettings["remote"];
        RemotingConfiguration.RegisterWellKnownServiceType(typeof(TestRemoting.InitialClass1), "TestRemoting", WellKnownObjectMode.Singleton);
        Console.WriteLine("Server is running on 1234 channel...");
        Console.WriteLine("Press Enter to Stop");
        Console.ReadLine();

and I am accessing that object in mu client form like

 InitialClass1 Icls = (InitialClass1)Activator.GetObject(typeof(InitialClass1), "tcp://localhost:1234//TestRemoting");

Now I am keeping my remote object in another computer. How can I access my server object from that computer. If I access the server object from my (local) computer, I will use

"tcp://localhost:1234//TestRemoting"

I am using localhost here, because my server object and my client is same. So If those two are different, How can I access the server object. I tried with my another computer IP as

tcp://200.100.0.52:1234//TestRemoting

that time I am getting an exception as

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 200.100.0.52:1234
Was it helpful?

Solution

The message means most of the time that the client cannot find the service. You can use the following steps to determine where the connection fails:

  1. Check if the service is running on the remote machine.
  2. Check if the port number is correct.
  3. Ping the remote machine from the client.
  4. Open a telnet session to the remote machine on the port number of service.

The step on which it fails gives an indication of why it is failing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top