This message was discovered on microsoft.public.dotnet.framework.remoting.
| Vivek |
Hello, I have an application which has 2 appdomains. It loads a class from a dll in 1 appdomain and another class from same dll in 2nd appdomain. I want to pass data between these classes. So i tried remoting. I configured class1 as server and class 2 as client.
But when i call a server method i receive only one usage of socket address is normally allowed exception message.
Here is my server side code :
oJobChannel = new TcpServerChannel ( 4121 ); ChannelServices.RegisterChannel( oJobChannel ); // register a well known type RemotingConfiguration.RegisterWellKnownServiceType( typeof( LogPanelPlugin ), "LogPanelPluginURI", WellKnownObjectMode.Singleton );
My client side code looks like this :
channel = new TcpClientChannel (); ChannelServices.RegisterChannel(channel); Panel = (LogPanelPlugin)RemotingServices.Connect(typeof(LogPanelPlugin),"tcp://localhost:4121/LogPanelPluginURI");
I have also tried registering wellknownclienttype etc with the same error.
Could anyone help me?
Thanks Vivek
|
|
| |
| |
| Ken Kolda |
The error simply means that some other process is already using port 4121. This could be due to:
1) You're unlucky and some other, unrelated process is using this port. Use "netstat -a" to see if that's the case. 2) You're actually trying to register the TcpChannel in both of your AppDomains. You need to ensure that the RegisterChannel() call is only executed once in your process. 3) You're running multiple processes concurrently so that another one of your processes has already claimed port 4121.
Also, just to be sure you're aware of this, but remoting objects between AppDomains in the same process does not require you to create a channel of any kind. The only tricky part is how you obtain a reference to the objects in the other domain (which is usually done via AppDomain.CreateInstanceAndUnwrap()). However, this may or may not be appropriate for your application -- can't say without additional details of why you're using two AppDomains -- but I wanted to throw that out.
Ken
"Vivek" <Click here to reveal e-mail address> wrote in message news:%23xHQ%Click here to reveal e-mail address... [Original message clipped]
host:4121/LogPanelPluginURI"); [Original message clipped]
|
|
| |
| |
| Vivek |
The problem was the server code was in the constructor. So RegisterChannel was being called twice(once when the Appdomain was being created and second when the proxy was instantiated).I removed it out of constructor and it works fine now.
The reason i am using channels is because i don't control the domains. I only have entry point in both domains, that just about it.
Vivek
"Ken Kolda" <Click here to reveal e-mail address> wrote in message news:OK%23E$Click here to reveal e-mail address... [Original message clipped]
|
|
| |
|
|
|
|
|
|