[Mono-list] Bi-directional remoting

Urs Muff umuff@quark.com
Fri, 21 Feb 2003 15:17:04 -0700


For those types of issues you can use .Net remoting through WebServices.
There are wrapper implementations out there for free, that do that.

- URS C. MUFF


> -----Original Message-----
> From: Steve Mentzer [mailto:steve.mentzer@mullinconsulting.com]
> Sent: Friday, February 21, 2003 2:50 PM
> To: mono-list@lists.ximian.com
> Subject: RE: [Mono-list] Bi-directional remoting
> 
> 
> ... which is also why this won't work when the client is behind a firewall
> or nat'ing device.
> 
> because of this little detail, it renders the technology almost useless.
> :)
> 
> 
> -----Original Message-----
> From: Lluis Sanchez [mailto:lluis@ideary.com]
> Sent: Friday, February 21, 2003 12:30 PM
> To: Bawcom, Aaron; Urs Muff; mono-list@lists.ximian.com
> Subject: Re: [Mono-list] Bi-directional remoting
> 
> 
> Correct. The client TcpChannel starts a listener using any free port. This
> port info is added to the object reference sent to the server. When the
> server calls a method of that object, it creates a new direct connection
> to
> the client.
> 
> ----- Original Message -----
> From: "Bawcom, Aaron" <aaron_bawcom@intrusion.com>
> To: "'Lluis Sanchez'" <lluis@ideary.com>; "Urs Muff" <umuff@quark.com>;
> <mono-list@lists.ximian.com>
> Sent: Friday, February 21, 2003 9:14 PM
> Subject: RE: [Mono-list] Bi-directional remoting
> 
> 
> > This creates an entirely new TCP connection right? It doesn't use the
> > existing TCP session already in place correct?
> >
> > -----Original Message-----
> > From: Lluis Sanchez [mailto:lluis@ideary.com]
> > Sent: Friday, February 21, 2003 12:51 PM
> > To: Urs Muff; mono-list@lists.ximian.com
> > Subject: Re: [Mono-list] Bi-directional remoting
> >
> >
> > Bi-directional remotingHi,
> >
> > In the client configuration file change <channel ref="tcp"> to <channel
> > ref="tcp" port="0">. This will create a tcp listener in the client
> (however,
> > in mono configuration files don't work yet).
> >
> > Lluis.
> >
> > ----- Original Message -----
> > From: Urs Muff
> > To: 'mono-list@lists.ximian.com'
> > Sent: Friday, February 21, 2003 7:26 PM
> > Subject: [Mono-list] Bi-directional remoting
> >
> >
> > How would you create such a bi-directional channel?  All the samples I
> used
> > so far are only server-client, but not the other way around. I have a
> > delegate that I want to implement on the client side.  The class
> > implementing the callback sits on the client (of course). I even use the
> > common abstract pattern described by a Microsoft KB article, but still
> no
> > luck. Debug output: ASP.Net Server starting Server.Do start An unhandled
> > exception of type 'System.Runtime.Remoting.RemotingException'
> > occurred in mscorlib.dll
> > Additional information: This remoting proxy has no channel sink which
> means
> > either the server has no registered server channels that are listening,
> or
> > this application has no suitable client channel to talk to the server.
> >
> >
> > Here is the sample code:
> >
> >
> > CommonLib: [both server and client have access]
> > -----------------------------------------------
> > using System;
> > using System.Runtime.Remoting;
> > public delegate void BaseEventHandler(object sender,RemoteEventArgs e);
> > [Serializable] public class RemoteEventArgs : EventArgs {
> >         public static new RemoteEventArgs Empty = new RemoteEventArgs();
> }
> > public abstract class RemoteCallback : MarshalByRefObject {
> >         [System.Runtime.Remoting.Messaging.OneWay]
> >         public void Callback(object sender,RemoteEventArgs e)
> >         {
> >                 CallbackImpl(sender,e);
> >         }
> >         protected abstract void CallbackImpl(object
> sender,RemoteEventArgs
> > e); } public interface IServer {
> >         event BaseEventHandler Evt;
> >         void Do();
> > }
> >
> >
> > ASP.Net Server:
> > --------------------------------------------
> > class S : MarshalByRefObject, IServer
> > {
> >         public event BaseEventHandler Evt;
> >         public void Do()
> >         {
> >                 System.Diagnostics.Debug.WriteLine("Server.Do start");
> >                 if (Evt != null) Evt(this,RemoteEventArgs.Empty);
> >                 System.Diagnostics.Debug.WriteLine("Server.Do end");
> >         }
> > }
> > public class Service1 : System.Web.Services.WebService
> > {
> >         ... // standard web service stuff (autogenerated)
> >         static bool Init = false;
> >         [WebMethod]
> >         public void StartUp()
> >         {
> >                 if (!Init)
> >                 {
> >
> RemotingConfiguration.Configure("/Server.config");
> >                         Init = true;
> >                 }
> >                 System.Diagnostics.Debug.WriteLine("ASP.Net Server
> > starting");
> >         }
> > }
> > <configuration>
> >   <system.runtime.remoting>
> >     <application>
> >       <service>
> >         <wellknown
> >            mode="Singleton"
> >            type="S, Server"
> >            objectUri="S"
> >         />
> >       </service>
> >       <channels>
> >         <channel ref="tcp" port="8085">
> >           <serverProviders>
> >                 <formatter ref="binary"/>
> >           </serverProviders>
> >         </channel>
> >       </channels>
> >     </application>
> >   </system.runtime.remoting>
> > </configuration>
> > Client:
> > --------------------------------------------
> > using System;
> > using System.Runtime.Remoting;
> > public class Test
> > {
> >         static void Main()
> >         {
> >                 RemotingConfiguration.Configure("../../Client.config");
> >
> >                 new Client.localhost.Service1().StartUp();
> >                 IServer s =
> > Activator.GetObject(typeof(IServer),"tcp://localhost:8085/S") as
> IServer;
> >                 s.Evt += new BaseEventHandler(
> >                         new ClientChangedCallback().Callback);
> >                 s.Do();
> >                 System.Diagnostics.Debug.WriteLine("I never get here");
> >         }
> > }
> > public class ClientChangedCallback : RemoteCallback
> > {
> >         protected override void CallbackImpl(object
> sender,RemoteEventArgs
> > e)
> >         {
> >                 System.Diagnostics.Debug.WriteLine("And of course I
> never
> > get here");
> >         }
> > }
> > <configuration>
> >   <system.runtime.remoting>
> >      <application>
> >         <channels>
> >            <channel ref="tcp">
> >               <clientProviders>
> >                  <formatter ref="binary"/>
> >               </clientProviders>
> >            </channel>
> >         </channels>
> >      </application>
> >   </system.runtime.remoting>
> > </configuration>
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list