[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

labreaks

10/18/2004 6:35:00 PM

Hi Guys,

I've been stuck on this one for quite some time now. Any help would
be greatly appreciated. I want to configure my client application to
remote certain objects on
two different servers. I want the objects created on server 1 to pass
through a client side sink, and I do not want the objects on server 2
to pass through the client sink.

When using the configuration file below, i get the following
exception: System.Net.Sockets.SocketException: Only one usage of each
socket address (protocol/network address/port) is normally permitted.

How do I set up my configuration file to use the custom sink on only
certain objects?

<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown type="whatever.UseSink_Object, whatever"
url="tcp://localhost:10000/SomeObject1.rem" />
<wellknown type="whatever.NoUseSink_Object, whatever"
url="tcp://localhost:10001/SomeObject2.rem" />
</client>
<channels>
<channel ref="tcp" port="10000" name="Server 1">
<clientProviders>
<formatter type="RemotingHelper.AbstractClientFormatterSinkProvider,
RemotingHelper"/>
</clientProviders>
<serverProviders>
<formatter ref="binary"/>
</serverProviders>
</channel>

<channel ref="tcp" port="10001" name="Server 2">
</channel>
</channels>

</application>
</system.runtime.remoting>
</configuration>
3 Answers

Sam Santiago

10/18/2004 7:21:00 PM

0

You cannot do what you wish. The sink chain applies to the whole app
domain, so all objects from the same app domain travel through it. You can
however within your custom formatter decide whether or not to perform your
custom formatting and if not you can use the standard binary formatter
(System.Runtime.Serialization.Formatters.Binary.BinaryFormatter) or SOAP
formatter (System.Runtime.Serialization.Formatters.Soap.SoapFormatter). You
could use the customFormatterProperty attribute of the formatter element to
configure if you would like to format in binary or soap if your formatter is
not used
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/...
tml/gnconformatterinstance.asp).

Check out these links:

SOAP formatter (has an example of programmatic use):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeserializationformatterssoapsoapformatterclas...

and

Sinks and Sink Chains
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsinkssink...


Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"labreaks" <labreaks@aol.com> wrote in message
news:d314fd5a.0410181034.5641ba82@posting.google.com...
> Hi Guys,
>
> I've been stuck on this one for quite some time now. Any help would
> be greatly appreciated. I want to configure my client application to
> remote certain objects on
> two different servers. I want the objects created on server 1 to pass
> through a client side sink, and I do not want the objects on server 2
> to pass through the client sink.
>
> When using the configuration file below, i get the following
> exception: System.Net.Sockets.SocketException: Only one usage of each
> socket address (protocol/network address/port) is normally permitted.
>
> How do I set up my configuration file to use the custom sink on only
> certain objects?
>
> <configuration>
> <system.runtime.remoting>
> <application>
> <client>
> <wellknown type="whatever.UseSink_Object, whatever"
> url="tcp://localhost:10000/SomeObject1.rem" />
> <wellknown type="whatever.NoUseSink_Object, whatever"
> url="tcp://localhost:10001/SomeObject2.rem" />
> </client>
> <channels>
> <channel ref="tcp" port="10000" name="Server 1">
> <clientProviders>
> <formatter type="RemotingHelper.AbstractClientFormatterSinkProvider,
> RemotingHelper"/>
> </clientProviders>
> <serverProviders>
> <formatter ref="binary"/>
> </serverProviders>
> </channel>
>
> <channel ref="tcp" port="10001" name="Server 2">
> </channel>
> </channels>
>
> </application>
> </system.runtime.remoting>
> </configuration>


Ken Kolda

10/18/2004 7:25:00 PM

0

What you have shown below will not get you where you want to be. When you
declare a <channel> with a non-zero port number in your config file, you're
creating a server channel. So, the remoting infrastructure will try to
attach a listener to this specified port to wait for remoting requests.
Since you already have your server processes running on that same machine
(using ports 10000 and 10001), you get the "port already in use" error.

In order to use different sinks for different channels, I'd recommend you
write this login into your client channel sink provider. In your provider
you could inspect the Uri of the remote system, check for a specific
property on the underlying channel object or use the channelData to indicate
whether you should include your custom sink or not. The provider would then
either hook in the sink or omit it and simply generate the rest of the sink
chain.

Hope that helps -
Ken


"labreaks" <labreaks@aol.com> wrote in message
news:d314fd5a.0410181034.5641ba82@posting.google.com...
> Hi Guys,
>
> I've been stuck on this one for quite some time now. Any help would
> be greatly appreciated. I want to configure my client application to
> remote certain objects on
> two different servers. I want the objects created on server 1 to pass
> through a client side sink, and I do not want the objects on server 2
> to pass through the client sink.
>
> When using the configuration file below, i get the following
> exception: System.Net.Sockets.SocketException: Only one usage of each
> socket address (protocol/network address/port) is normally permitted.
>
> How do I set up my configuration file to use the custom sink on only
> certain objects?
>
> <configuration>
> <system.runtime.remoting>
> <application>
> <client>
> <wellknown type="whatever.UseSink_Object, whatever"
> url="tcp://localhost:10000/SomeObject1.rem" />
> <wellknown type="whatever.NoUseSink_Object, whatever"
> url="tcp://localhost:10001/SomeObject2.rem" />
> </client>
> <channels>
> <channel ref="tcp" port="10000" name="Server 1">
> <clientProviders>
> <formatter type="RemotingHelper.AbstractClientFormatterSinkProvider,
> RemotingHelper"/>
> </clientProviders>
> <serverProviders>
> <formatter ref="binary"/>
> </serverProviders>
> </channel>
>
> <channel ref="tcp" port="10001" name="Server 2">
> </channel>
> </channels>
>
> </application>
> </system.runtime.remoting>
> </configuration>


labreaks

10/21/2004 12:29:00 AM

0

thanks guys this solution works out great. I just put some logic
inside of the provider as specified.

"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message news:<O0hQGhUtEHA.3788@TK2MSFTNGP09.phx.gbl>...
> What you have shown below will not get you where you want to be. When you
> declare a <channel> with a non-zero port number in your config file, you're
> creating a server channel. So, the remoting infrastructure will try to
> attach a listener to this specified port to wait for remoting requests.
> Since you already have your server processes running on that same machine
> (using ports 10000 and 10001), you get the "port already in use" error.
>
> In order to use different sinks for different channels, I'd recommend you
> write this login into your client channel sink provider. In your provider
> you could inspect the Uri of the remote system, check for a specific
> property on the underlying channel object or use the channelData to indicate
> whether you should include your custom sink or not. The provider would then
> either hook in the sink or omit it and simply generate the rest of the sink
> chain.
>
> Hope that helps -
> Ken
>
>
> "labreaks" <labreaks@aol.com> wrote in message
> news:d314fd5a.0410181034.5641ba82@posting.google.com...
> > Hi Guys,
> >
> > I've been stuck on this one for quite some time now. Any help would
> > be greatly appreciated. I want to configure my client application to
> > remote certain objects on
> > two different servers. I want the objects created on server 1 to pass
> > through a client side sink, and I do not want the objects on server 2
> > to pass through the client sink.
> >
> > When using the configuration file below, i get the following
> > exception: System.Net.Sockets.SocketException: Only one usage of each
> > socket address (protocol/network address/port) is normally permitted.
> >
> > How do I set up my configuration file to use the custom sink on only
> > certain objects?
> >
> > <configuration>
> > <system.runtime.remoting>
> > <application>
> > <client>
> > <wellknown type="whatever.UseSink_Object, whatever"
> > url="tcp://localhost:10000/SomeObject1.rem" />
> > <wellknown type="whatever.NoUseSink_Object, whatever"
> > url="tcp://localhost:10001/SomeObject2.rem" />
> > </client>
> > <channels>
> > <channel ref="tcp" port="10000" name="Server 1">
> > <clientProviders>
> > <formatter type="RemotingHelper.AbstractClientFormatterSinkProvider,
> > RemotingHelper"/>
> > </clientProviders>
> > <serverProviders>
> > <formatter ref="binary"/>
> > </serverProviders>
> > </channel>
> >
> > <channel ref="tcp" port="10001" name="Server 2">
> > </channel>
> > </channels>
> >
> > </application>
> > </system.runtime.remoting>
> > </configuration>