ClientSponsor::RenewalTime Property

 

Gets or sets the TimeSpan by which to increase the lifetime of the sponsored objects when renewal is requested.

Namespace:   System.Runtime.Remoting.Lifetime
Assembly:  mscorlib (in mscorlib.dll)

public:
property TimeSpan RenewalTime {
	TimeSpan get();
	void set(TimeSpan value);
}

Property Value

Type: System::TimeSpan

The TimeSpan by which to increase the lifetime of the sponsored objects when renewal is requested.

int main()
{
   // Register a channel.
   TcpChannel^ myChannel = gcnew TcpChannel;
   ChannelServices::RegisterChannel( myChannel );
   RemotingConfiguration::RegisterActivatedClientType(
      RemotingSamples::HelloService::typeid, "tcp://localhost:8085/" );

   // Get the remote Object*.
   RemotingSamples::HelloService ^ myService = gcnew RemotingSamples::HelloService;

   // Get a sponsor for renewal of time.
   ClientSponsor^ mySponsor = gcnew ClientSponsor;

   // Register the service with sponsor.
   mySponsor->Register( myService );

   // Set renewaltime.
   mySponsor->RenewalTime = TimeSpan::FromMinutes( 2 );

   // Renew the lease.
   ILease^ myLease = dynamic_cast<ILease^>(mySponsor->InitializeLifetimeService());
   TimeSpan myTime = mySponsor->Renewal( myLease );
   Console::WriteLine( "Renewed time in minutes is {0}", myTime.Minutes );

   // Call the remote method.
   Console::WriteLine( myService->HelloMethod( "World" ) );

   // Unregister the channel.
   mySponsor->Unregister( myService );
   mySponsor->Close();
}

.NET Framework
Available since 1.1
Return to top
Show: