Re: Remoted object is connectable even after disconnecting it...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ken Kolda (ken.kolda_at_elliemae-nospamplease.com)
Date: 09/24/04


Date: Fri, 24 Sep 2004 08:12:15 -0700

You will need to invoke some property or method to determine if the server
is still up. Using ToString() is often the easiest bet.

Ken

"TT (Tom Tempelaere)" <_|\|_0$P@|/\|titi____AThotmailD.Tcom|/\|@P$0_|\|_>
wrote in message news:68972BB8-FBFA-42CA-9978-4D717D94FA56@microsoft.com...
> Hi Ken,
>
> I tested and indeed a TranparantProxy is made. How can I check whether the
> remoted object is alive, without having to call a method I wrote? A sort
of a
> ping but then for the remoted object...
>
> Thank you.
> Tom T.
>
>
> "Ken Kolda" wrote:
>
> > The call to RemotingServices.Connect() does not actually cause a
connection
> > to be made to the server -- it just creates a proxy. The actual
connection
> > is made the first time you invoke a property or method on the proxy
object.
> > At that point you should get an exception indicating that no connection
can
> > be made to the server.
> >
> > Ken
> >
> >
> > "TT (Tom Tempelaere)"
<_|\|_0$P@|/\|titi____AThotmailD.Tcom|/\|@P$0_|\|_>
> > wrote in message
news:090D8A15-9C01-43A4-A4B1-958DDCDACB9C@microsoft.com...
> > > Hi there,
> > >
> > > In my current project I have a logging utility that is a standalone
app.
> > The
> > > utility shows log entries, other apps can connect to it and send
logging
> > > entries to be displayed.
> > >
> > > I use RemotingServices.Marshal at startup of the log util to allow
other
> > > apps to access the logging utility. When the log util is closed, I use
> > > RemotingServices.Disconnect to make the log app unavailable.
> > >
> > > The problem is that even when I close my log util, clients can still
> > connect
> > > to the remoted (log-)object. I'll add some code to clarify. Class
MyLog is
> > a
> > > MarshalByRefObject, which implements IMyLog which contains the real
> > > interface. MyLog overrides InitializeLifetimeService method and
returns
> > null
> > > as lease timeout.
> > >
> > > <code>
> > >
> > > // log-server startup:
> > > // ---------------------
> > > this.channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel (
> > > this.config.Channel
> > > );
> > >
> > > System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel (
> > > this.channel
> > > );
> > >
> > > this.myLog = new MyLog( this ); // the remoted object
> > >
> > > System.Runtime.Remoting.RemotingServices.Marshal (
> > > this.myLog,
> > > this.config.MyLogURI,
> > > typeof( IMyLog )
> > > );
> > >
> > > // log-server shutdown code:
> > > // ------------------------------
> > > if( this.myLog != null )
> > > System.Runtime.Remoting.RemotingServices.Disconnect (
> > > this.myLog
> > > );
> > >
> > > if( this.channel != null
> > > )System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(
> > > this.channel );
> > >
> > > // client connection code:
> > > // --------------------------
> > > string connectionStr = "tcp://" + this.config.Address + ":" +
> > > this.config.Channel.ToString() +
"/" +
> > > this.config.MyLogURI;
> > >
> > > object objref = System.Runtime.Remoting.RemotingServices.Connect (
> > > typeof( IMyLog ),
> > > connectionStr
> > > );
> > >
> > > this.myLog = objref as IMyLog;
> > >
> > > </code>
> > >
> > > So, even if my log app is closed and hence the shutdown code is run
and
> > the
> > > remoted object should be dead, clients can still connect to it i.e.
the
> > > RemotingService.Connect call succeeds.
> > >
> > > What am I doing wrong? Thanks for any help :)
> > >
> > > Kind regards.
> > > --
> > > Tom Tempelaere.
> >
> >
> >



Relevant Pages

  • Control.Invoke not as synchronous as I thought
    ... Create a client to connect to the server. ... connection, it should display "Client connected" in the textbox. ... I use Invoke to update the textbox. ... nPortNumber) -> localHostAddress"); ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Outgoing POP3 email missing/lost/not received
    ... Funny thing is that I have had this ISP for 8 years and it has always been ... It looks like when you last ran CEICW, you set the ISP's mail server to: ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)
  • Re: Cannot connect client to server 2003
    ... you need to reconfigure the IP schema of your SBS ... On the SBS 2003 Server open the Server Management console. ... On the Connection Type page, click Broadband, and then click Next. ... Alternate DNS server, type the IP addresses that are provided by your ISP ...
    (microsoft.public.windows.server.sbs)
  • Re: Outgoing POP3 email missing/lost/not received
    ... ISP's mail server instead of the domain name on the ... SUMMARY OF SETTINGS FOR CONFIGURE E-MAIL AND INTERNET ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)
  • Re: Networking Question - VLANs on SBS 2003 Premium SP1
    ... port on the old router so I now have a segregated WLAN. ... be sure you do not enable any DHCP server in internal network. ... On the Connection Type page, click Broadband, and then click Next. ... On the Network Connection, You must enable and configure the network ...
    (microsoft.public.windows.server.sbs)