<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FNetwork_Remote%2FRemote_Life_Time</id>
		<title>VB.Net/Network Remote/Remote Life Time - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FNetwork_Remote%2FRemote_Life_Time"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Network_Remote/Remote_Life_Time&amp;action=history"/>
		<updated>2026-04-05T07:12:49Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/Network_Remote/Remote_Life_Time&amp;diff=944&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Network_Remote/Remote_Life_Time&amp;diff=944&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/Network_Remote/Remote_Life_Time&amp;diff=945&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Network_Remote/Remote_Life_Time&amp;diff=945&amp;oldid=prev"/>
				<updated>2010-05-26T12:45:36Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Initialize Lifetime Service (bugs)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
///////////////////////////////////general.vb&lt;br /&gt;
// Compile: vbc /target:library  general.vb&lt;br /&gt;
Imports System&lt;br /&gt;
Public Interface IRemoteObject&lt;br /&gt;
    Sub setValue(ByVal newval As Integer)&lt;br /&gt;
    Function getValue() As Integer&lt;br /&gt;
End Interface&lt;br /&gt;
Public Interface IRemoteFactory&lt;br /&gt;
    Overloads Function getNewInstance() As IRemoteObject&lt;br /&gt;
    Overloads Function getNewInstance(ByVal initvalue As Integer) As IRemoteObject&lt;br /&gt;
End Interface&lt;br /&gt;
&lt;br /&gt;
///////////////////////////////////test.vb&lt;br /&gt;
// Compile: vbc /t:exe /r:general.dll test.vb&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Runtime.Remoting&lt;br /&gt;
Imports System.Runtime.Remoting.Channels.Http&lt;br /&gt;
Imports System.Runtime.Remoting.Channels&lt;br /&gt;
Module Client&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        Dim channel As New HttpChannel()&lt;br /&gt;
        ChannelServices.RegisterChannel(channel,false)&lt;br /&gt;
        Dim fact As IRemoteFactory = CType(Activator.GetObject( _&lt;br /&gt;
            GetType(IRemoteFactory), _&lt;br /&gt;
            &amp;quot;http://localhost:1234/factory.soap&amp;quot;), _&lt;br /&gt;
            IRemoteFactory)&lt;br /&gt;
        Dim obj1 As IRemoteObject = fact.getNewInstance()&lt;br /&gt;
&amp;quot;        System.Threading.Thread.Sleep(1000)&lt;br /&gt;
        Console.WriteLine(&amp;quot;call remote method&amp;quot;)&lt;br /&gt;
        Try&lt;br /&gt;
            obj1.setValue(42)&lt;br /&gt;
        Catch e As Exception&lt;br /&gt;
            Console.WriteLine(&amp;quot;Client.Main(). EXCEPTION &amp;quot; + vbCrLf + e.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
///////////////////////////////////server.vb&lt;br /&gt;
// vbc /target:exe  /r:general.dll server.vb&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Runtime.Remoting&lt;br /&gt;
Imports System.Runtime.Remoting.Channels.Http&lt;br /&gt;
Imports System.Runtime.Remoting.Channels&lt;br /&gt;
Imports System.Runtime.Remoting.Lifetime&lt;br /&gt;
Class MyRemoteObject&lt;br /&gt;
    Inherits MarshalByRefObject&lt;br /&gt;
    Implements IRemoteObject&lt;br /&gt;
    Private myvalue As Integer&lt;br /&gt;
&lt;br /&gt;
    Public Overrides Function InitializeLifetimeService() As Object&lt;br /&gt;
        Dim lease As ILease = CType(MyBase.InitializeLifetimeService(), ILease)&lt;br /&gt;
        If lease.CurrentState = LeaseState.Initial Then&lt;br /&gt;
            lease.InitialLeaseTime = TimeSpan.FromMilliseconds(10)&lt;br /&gt;
            lease.SponsorshipTimeout = TimeSpan.FromMilliseconds(10)&lt;br /&gt;
            lease.RenewOnCallTime = TimeSpan.FromMilliseconds(10)&lt;br /&gt;
        End If&lt;br /&gt;
        Return lease&lt;br /&gt;
    End Function&lt;br /&gt;
&lt;br /&gt;
    Public Sub New()&lt;br /&gt;
       myvalue = 0&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Sub New(ByVal startvalue As Integer)&lt;br /&gt;
        myvalue = startvalue&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Sub setValue(ByVal newval As Integer) _&lt;br /&gt;
    Implements IRemoteObject.setValue&lt;br /&gt;
        myvalue = newval&lt;br /&gt;
    End Sub&lt;br /&gt;
    Public Function getValue() As Integer _&lt;br /&gt;
    Implements IRemoteObject.getValue&lt;br /&gt;
        Return myvalue&lt;br /&gt;
    End Function&lt;br /&gt;
End Class&lt;br /&gt;
Class MyRemoteFactory&lt;br /&gt;
    Inherits MarshalByRefObject&lt;br /&gt;
    Implements IRemoteFactory&lt;br /&gt;
    Public Function getNewInstance() As IRemoteObject _&lt;br /&gt;
    Implements IRemoteFactory.getNewInstance&lt;br /&gt;
        Console.WriteLine(&amp;quot;create object with no argment&amp;quot;)&lt;br /&gt;
        Return New MyRemoteObject()&lt;br /&gt;
    End Function&lt;br /&gt;
    Public Function getNewInstance(ByVal initvalue As Integer) As IRemoteObject _&lt;br /&gt;
    Implements IRemoteFactory.getNewInstance&lt;br /&gt;
        Console.WriteLine(&amp;quot;create object with argument&amp;quot;)&lt;br /&gt;
        Return New MyRemoteObject(initvalue)&lt;br /&gt;
    End Function&lt;br /&gt;
&lt;br /&gt;
End Class&lt;br /&gt;
Module ServerStartup&lt;br /&gt;
    Sub Main()&lt;br /&gt;
        LifetimeServices.LeaseManagerPollTime = TimeSpan.FromMilliseconds(10)&lt;br /&gt;
        Dim chnl As New HttpChannel(1234)&lt;br /&gt;
        ChannelServices.RegisterChannel(chnl,false)&lt;br /&gt;
        RemotingConfiguration.RegisterWellKnownServiceType( _&lt;br /&gt;
            GetType(MyRemoteFactory), _&lt;br /&gt;
            &amp;quot;factory.soap&amp;quot;, _&lt;br /&gt;
            WellKnownObjectMode.Singleton)&lt;br /&gt;
        Console.WriteLine(&amp;quot;Server started&amp;quot;)&lt;br /&gt;
        Console.ReadLine()&lt;br /&gt;
    End Sub&lt;br /&gt;
End Module&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>