[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.remoting

Re: Setting exclusiveAddressUse = false

Sam Santiago

8/27/2004 5:03:00 PM

Why do you think you need 2 channels with the same port? I do not think
this is possible. This is a socket level restriction. You're probably
getting this error:

System.Net.Sockets.SocketException: Only one usage of each socket address
(protocol/network address/port) is normally permitted

Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"Barry" <Barry@discussions.microsoft.com> wrote in message
news:43BF1DC3-46BF-4B74-9E70-FCB54F9F0D22@microsoft.com...
> Trying to understand why I cannot have two channels registered to the same
> port. This is a test case for a business problem I am trying to solve.
Any
> help appreciated?
>
> using System;
> using System.IO;
> using System.Net;
> using System.Collections;
> using System.Diagnostics;
> using System.Reflection;
> using System.Runtime.Remoting;
> using System.Runtime.Remoting.Channels;
> using System.Runtime.Remoting.Channels.Tcp;
> using System.Runtime.Remoting.Channels.Http;
>
> namespace ChannelTest
> {
> /// <summary>
> /// Summary description for Class1.
> /// </summary>
> class Class1
> {
> /// <summary>
> /// The main entry point for the application.
> /// </summary>
> [STAThread]
> static void Main(string[] args)
> {
> //
> // TODO: Add code to start application here
> //
> try
> {
> IChannel channel = MakeChannel(1240);
> System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel);
>
> IChannel channel = MakeChannel(1240);
> System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel);
>
> }
> catch(Exception e)
> {
> Console.WriteLine(e.Message);
> }
> Console.ReadLine();
> }
>
> public static TcpChannel MakeChannel(int port)
> {
> IDictionary props = new Hashtable();
> // Specifies the port on which the channel will listen.
> // If 0 is specified, then the remoting system will
> // locate an open port for you.
> props["port"] = port;
> // Indicates the name of the channel. If this property is not set,
> // the system defaults to the scheme name. If you want to register
> // more than one ChannelProvider with the same scheme, each must
> // have a unique name. String.Empty will allow any number of
> // similar schemas without name collisions.
> props["name"] = String.Empty;
> props["exclusiveAddressUse"] = false;
>
> BinaryServerFormatterSinkProvider binaryProvider = new
> BinaryServerFormatterSinkProvider();
> binaryProvider.TypeFilterLevel =
> System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
>
> return new TcpChannel(props, null, binaryProvider);
> }
>
> }
> }
>
> --
> Barry Lattie


1 Answer

Sam Santiago

8/27/2004 8:06:00 PM

0

Having two processes listening on the same port just doesn't seem easily
possible without some special software. You would need to write/buy
software that can route incoming traffic properly to the proper application.

Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"Barry" <Barry@discussions.microsoft.com> wrote in message
news:FFCE8AF5-808E-4307-AA9D-E228D1DBC2A9@microsoft.com...
> We have encapsulated an older STA active x control inside a console
> application so that it can be used by multiple server process at one time:
> each active x process inside a separate STA app domain. These console
> applications start and communicate pack to the client.
>
> Everything works fine, however the client's initial communication was to a
> server endpoint at port[nnnn]. These individual console applications
> currently allow .NET to chose an open port for returning information to
the
> client, the return packes are from port[yyyy]. This is causing concern at
> sites where restrictive firewalls are in place.
>
> We need these individual app domains to communicate on the same port as
the
> primary server application, that is why the reuse.
>
> As I read the Tcp/Http Channel docs and the Sockets docs it seems that
> setting the channel property["exclusiveAddressUse"] = false should allow
this
> to be reused.
>
>
>
>
> We need the indic=videaul
>
> "Sam Santiago" wrote:
>
> > Why do you think you need 2 channels with the same port? I do not think
> > this is possible. This is a socket level restriction. You're probably
> > getting this error:
> >
> > System.Net.Sockets.SocketException: Only one usage of each socket
address
> > (protocol/network address/port) is normally permitted
> >
> > Thanks,
> >
> > Sam
> >
> > --
> > _______________________________
> > Sam Santiago
> > ssantiago@n0spam-SoftiTechture.com
> > http://www.SoftiTe...
> > _______________________________
> > "Barry" <Barry@discussions.microsoft.com> wrote in message
> > news:43BF1DC3-46BF-4B74-9E70-FCB54F9F0D22@microsoft.com...
> > > Trying to understand why I cannot have two channels registered to the
same
> > > port. This is a test case for a business problem I am trying to
solve.
> > Any
> > > help appreciated?
> > >
> > > using System;
> > > using System.IO;
> > > using System.Net;
> > > using System.Collections;
> > > using System.Diagnostics;
> > > using System.Reflection;
> > > using System.Runtime.Remoting;
> > > using System.Runtime.Remoting.Channels;
> > > using System.Runtime.Remoting.Channels.Tcp;
> > > using System.Runtime.Remoting.Channels.Http;
> > >
> > > namespace ChannelTest
> > > {
> > > /// <summary>
> > > /// Summary description for Class1.
> > > /// </summary>
> > > class Class1
> > > {
> > > /// <summary>
> > > /// The main entry point for the application.
> > > /// </summary>
> > > [STAThread]
> > > static void Main(string[] args)
> > > {
> > > //
> > > // TODO: Add code to start application here
> > > //
> > > try
> > > {
> > > IChannel channel = MakeChannel(1240);
> > >
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel);
> > >
> > > IChannel channel = MakeChannel(1240);
> > >
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel);
> > >
> > > }
> > > catch(Exception e)
> > > {
> > > Console.WriteLine(e.Message);
> > > }
> > > Console.ReadLine();
> > > }
> > >
> > > public static TcpChannel MakeChannel(int port)
> > > {
> > > IDictionary props = new Hashtable();
> > > // Specifies the port on which the channel will listen.
> > > // If 0 is specified, then the remoting system will
> > > // locate an open port for you.
> > > props["port"] = port;
> > > // Indicates the name of the channel. If this property is not set,
> > > // the system defaults to the scheme name. If you want to register
> > > // more than one ChannelProvider with the same scheme, each must
> > > // have a unique name. String.Empty will allow any number of
> > > // similar schemas without name collisions.
> > > props["name"] = String.Empty;
> > > props["exclusiveAddressUse"] = false;
> > >
> > > BinaryServerFormatterSinkProvider binaryProvider = new
> > > BinaryServerFormatterSinkProvider();
> > > binaryProvider.TypeFilterLevel =
> > > System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
> > >
> > > return new TcpChannel(props, null, binaryProvider);
> > > }
> > >
> > > }
> > > }
> > >
> > > --
> > > Barry Lattie
> >
> >
> >