.NETGURU
Only one usage of each socket address(protocol/network/port) is normally allowed
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.

Post a new message to this list...

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

Reply to this message...
 
    
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]

Reply to this message...
 
    
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]

Reply to this message...
 
 
System.AppDomain
System.Runtime.Remoting.Channels.ChannelServices
System.Runtime.Remoting.Channels.Tcp.TcpChannel
System.Runtime.Remoting.Channels.Tcp.TcpClientChannel
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel
System.Runtime.Remoting.RemotingConfiguration
System.Runtime.Remoting.RemotingServices
System.Runtime.Remoting.WellKnownObjectMode




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification