<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://vistapedia.com/index.php?action=history&amp;feed=atom&amp;title=RPC_HELP_TRPCBroker_Connected</id>
	<title>RPC HELP TRPCBroker Connected - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://vistapedia.com/index.php?action=history&amp;feed=atom&amp;title=RPC_HELP_TRPCBroker_Connected"/>
	<link rel="alternate" type="text/html" href="https://vistapedia.com/index.php?title=RPC_HELP_TRPCBroker_Connected&amp;action=history"/>
	<updated>2026-05-03T02:43:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://vistapedia.com/index.php?title=RPC_HELP_TRPCBroker_Connected&amp;diff=16560&amp;oldid=prev</id>
		<title>Kdtop: Created page with &quot;&lt;h2&gt;Connected Property&lt;/h2&gt; Example  &lt;h3&gt;Applies to&lt;/h3&gt;     TRPCBroker component 	 &lt;h3&gt;Declaration&lt;/h3&gt;     ...&quot;</title>
		<link rel="alternate" type="text/html" href="https://vistapedia.com/index.php?title=RPC_HELP_TRPCBroker_Connected&amp;diff=16560&amp;oldid=prev"/>
		<updated>2015-07-04T17:08:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;h2&amp;gt;Connected Property&amp;lt;/h2&amp;gt; &lt;a href=&quot;/index.php/RPC_HELP_TRPCBroker_Connected_Example&quot; title=&quot;RPC HELP TRPCBroker Connected Example&quot;&gt;Example&lt;/a&gt;  &amp;lt;h3&amp;gt;Applies to&amp;lt;/h3&amp;gt;     &lt;a href=&quot;/index.php/RPC_HELP_TRPCBroker&quot; title=&quot;RPC HELP TRPCBroker&quot;&gt;TRPCBroker&lt;/a&gt; component 	 &amp;lt;h3&amp;gt;Declaration&amp;lt;/h3&amp;gt;     ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;h2&amp;gt;Connected Property&amp;lt;/h2&amp;gt;&lt;br /&gt;
[[RPC_HELP_TRPCBroker_Connected_Example|Example]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Applies to&amp;lt;/h3&amp;gt;&lt;br /&gt;
    [[RPC_HELP_TRPCBroker|TRPCBroker]] component&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;h3&amp;gt;Declaration&amp;lt;/h3&amp;gt;&lt;br /&gt;
    property Connected: Boolean;&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;h3&amp;gt;Description&amp;lt;/h3&amp;gt;&lt;br /&gt;
The Connected design-time property connects your application to the VistA M Server:&lt;br /&gt;
* Setting this property to True connects the application to the server.&lt;br /&gt;
* Setting it to False disconnects the application from the server.&lt;br /&gt;
	&lt;br /&gt;
It is not necessary for your application to manually establish a connection to the VistA M Server. This version of the Broker automatically connects and disconnects from the server. When you invoke an [[RPC_HELP_RPCs|RPC]], if a connection has not already been established, one will be established for you. However, a user will not be able to run your RPC unless a context has been created with the [[RPC_HELP_TRPCBroker_CreateContext_Method|CreateContext]] method.&lt;br /&gt;
&lt;br /&gt;
There are other advantages to establishing a connection manually. You can check if a connection is established, and branch accordingly depending on whether a connection was established or not. One good place to do this is in your application form&amp;#039;s OnCreate event. For that event, you could include code like the following:	&lt;br /&gt;
&lt;br /&gt;
    &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
      brkrRPCBroker1.Connected:= True;&lt;br /&gt;
    &amp;#039;&amp;#039;&amp;#039;except&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
      on EBrokerError do begin&lt;br /&gt;
        ShowMessage(&amp;#039;Connection to server could not be established!&amp;#039;);&lt;br /&gt;
        Application.Terminate;&lt;br /&gt;
      &amp;#039;&amp;#039;&amp;#039;end;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
    &amp;#039;&amp;#039;&amp;#039;end;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
This code sets the [[RPC_HELP_TRPCBroker|TRPCBroker]] component&amp;#039;s Connected property to True to establish a connection. If a Broker exception (i.e., [[RPC_HELP_TRPCB_EBrokerError|EBrokerError]]) was raised (in which case the connection wasn&amp;#039;t established), it provides a message to the user and calls the Terminate method to exit.&lt;br /&gt;
&lt;br /&gt;
To verify that your application is connected to the VistA M Server, check the value of the Connected property.&lt;br /&gt;
	&lt;br /&gt;
If a connected [[RPC_HELP_TRPCBroker|TRPCBroker]] component is destroyed (when the application is closed, for example), that component will first disconnect from the VistA M Server. However, for programming clarity, it is advisable to disconnect your application from the server manually by setting the Connected property to False.&lt;br /&gt;
&lt;br /&gt;
If your application uses more than one Broker component, you should be aware of the component&amp;#039;s [[RPC_HELP_TRPCBroker_connect_and_disconnect_behavior|connect and disconnect behavior]].&lt;/div&gt;</summary>
		<author><name>Kdtop</name></author>
	</entry>
</feed>