c# - How to access remote object from other computer in remoting -
i have server object
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 running on 1234 channel..."); console.writeline("press enter stop"); console.readline();
and accessing object in mu client form like
initialclass1 icls = (initialclass1)activator.getobject(typeof(initialclass1), "tcp://localhost:1234//testremoting");
now keeping remote object in computer. how can access server object computer. if access server object (local) computer, use
"tcp://localhost:1234//testremoting"
i using localhost here, because server object , client same. if 2 different, how can access server object. tried computer ip as
tcp://200.100.0.52:1234//testremoting
that time getting exception
a connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond 200.100.0.52:1234
the message means of time client cannot find service. can use following steps determine connection fails:
- check if service running on remote machine.
- check if port number correct.
- ping remote machine client.
- open telnet session remote machine on port number of service.
the step on fails gives indication of why failing.
Comments
Post a Comment