2
Answers

Cannot connect 2nd Client to server when first client is already loggedIn, happens only incase when server in different network

Rupinder

Rupinder

15y
3.8k
1
Hi All, I am building a collaborative application, where two or more clients can logIn to a (remoting) server. My application runs fine, when both the client machines and the server; all three are in same network. But If the client machine are running/accesing the server from a network differnet from where the server is; Only the first client login is sucessfull, and after that second client login fails. Error I get on second client machine trying to login to ther sever: Could not connect to server: System.Runtime.Remoting.RemotingException:Server encountered an internal error. For more information, turn off customErrors in the server's .config file. Server stack trace: Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32 type) at MyRemotableClasses.MyRemotableObject.RemoteFunction() at ClientApp.CallRemoteFunction(); _________________________________________________________________________ Code on server which makes remoting channels: ********************************************* string name = NAME +".channel" + cid.ToString(); int port = PORT + cid; IDictionary props = new Hashtable(); props["name"] = name; props["priority"] = "100"; props["port"] = port; BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider(); provider.TypeFilterLevel = TypeFilterLevel.Full; TcpChannel channel = new TcpChannel(props, null, provider); ChannelServices.RegisterChannel(channel, false); WellKnownServiceTypeEntry wkste = new WellKnownServiceTypeEntry(typeof(RemoteClasses.Server), name, WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(wkste); -------------------------------------------- Client-Side: ******************* BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider(); BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider(); serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; IDictionary props = new Hashtable(); props["port"] = 0; clientChannel = new TcpChannel(props, clientProvider, serverProvider); ChannelServices.RegisterChannel(clientChannel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteClasses.Server), "Server", WellKnownObjectMode.Singleton); server = (RemoteClasses.Server)Activator.GetObject(typeof(RemoteClasses.Server), @"tcp://" + serverip + ":" + port + "/" + servername + ".channel" + channel); ___________________________________________________ Need some troubleshooting tips; as to why the second client fails to login...incase when clients are in a differnt network than that of server (hosting the remotable object). thanks in advance!
Answers (2)