<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to client</title><link>https://sourceforge.net/p/epicssharp/wiki/client/</link><description>Recent changes to client</description><atom:link href="https://sourceforge.net/p/epicssharp/wiki/client/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 10 Jul 2014 13:57:44 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/epicssharp/wiki/client/feed" rel="self" type="application/rss+xml"/><item><title>client modified by Daniel J. Lauk</title><link>https://sourceforge.net/p/epicssharp/wiki/client/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,25 +1,38 @@
 # Client Library

-NuGet package (binary only):
+The EpicsSharp project provides a C# implementation of the channel access protocol. This is the client part of the communication.
+
+## How to obtain
+
+The client library is available in the following ways:
+
+* **NuGet** package (binary only):
 https://www.nuget.org/packages/EpicsClient2/
-
-Download the client library here (client directory):
+* **Source** code: Download the client library here (client directory):
 https://sourceforge.net/p/epicssharp/code/

-Add the reference of the EpicsClient2 assembly to your project.
+In Visual Studio, add the reference of the `EpicsClient2` assembly to your project.

-To use it:
+
+## How to use
+
+We try very hard to keep the client facing API simple. We sincerely hope you appreciate that effort and the brevity of the examples. (Really, that *is* all the code you need.)
+
+
+### Reading a PV
+
+This example will read the EPICS PV `MY-EPICS-CHANNEL:VALUE`, requesting it as a `string`, and print out the received value on the console. Please note, that for the client program, the call to `channel.Get()` is *synchronous* (i.e. blocking).

 ~~~~~~
 EpicsClient client = new EpicsClient();
-client.Configuration.SearchAddress = "255.255.255.255:5064";
 var channel = client.CreateChannel&amp;lt;string&amp;gt;("MY-EPICS-CHANNEL:VALUE");
 Console.WriteLine(channel.Get());
 ~~~~~~

-the client.Configuration.SearchAddress can be left out and it will then use the default EPICS search port on the local broadcast address. You can however specify one or more search addresses separated by semi-colons.

-To use monitors instead of get use the event MonitorChanged:
+### Monitoring a PV
+
+To use EPICS monitors (called *events* in channel access) use the event `MonitorChanged`:

 ~~~~~~
 class Program
@@ -29,9 +42,8 @@
     static void Main(string[] args)
     {
         EpicsClient client = new EpicsClient();
-        client.Configuration.SearchAddress = "129.129.130.87:5432";

-        channel = client.CreateChannel&amp;lt;string&amp;gt;("ADG1:IST1:2");
+        channel = client.CreateChannel&amp;lt;string&amp;gt;("MY-EPICS-CHANNEL:VALUE");
         channel.StatusChanged += new EpicsStatusDelegate(channel_StatusChanged);
         channel.MonitorChanged += new EpicsDelegate&amp;lt;string&amp;gt;(channel_MonitorChanged);

@@ -50,4 +62,49 @@
 }
 ~~~~~~

-type += and then 2 tabs which will generate for you the skeleton callback function.
+**Tip:** In Visual Studio, type `+=` followed by 2 tabs. This will generate the skeleton callback function for you.
+
+
+### Using a gateway
+
+If your client needs to be on a different network than your server(s), e.g. if your office and machine networks are separated by firewalls, the EPICS default behaviour (a broadcast on the local network) will not work. You will have to use a channel access gateway. (Isn't it handy, the EpicsSharp project provides such a [gateway]?)
+
+With our client library, using a gateway is easy. In fact, it is even possible (and not really any harder) use multiple gateways, in case you need to communicate with several networks.
+
+
+#### Alternative 1: Specify the gateway in the code
+
+For quick tests you can provide the gateway(s) in the code like this:
+
+~~~~~~
+EpicsClient client = new EpicsClient();
+client.Configuration.SearchAddress = "192.168.1.50";
+~~~~~~
+
+**Please note** that you have to specify the gateway, **before** you create a channel.
+
+
+#### Alternative 2: Specify the gateway in the application configuration
+
+You can also specify the gateway(s) to use via the .NET configuration mechanism, i.e. in you `App.config` or `web.config` XML files. Just add the key `e#ServerList` to your `appSettings` like this, and the client library will pick it up:
+
+~~~~~~
+&amp;lt;appSettings&amp;gt;
+  &amp;lt;add key="e#ServerList" value="192.168.1.50"/&amp;gt;
+&amp;lt;/appSettings&amp;gt;
+~~~~~~
+
+Using this approach has the following advantages, that if the address(es) of the gateways change, you do not need to rebuild your software and redistribute it.
+
+
+#### Gateway specification syntax
+
+The gateway to be used can be specified in the following ways (you're probably familiar with these already):
+
+* An IPv4 address in dotted notation, including a port number (e.g. `192.168.1.50:1234`)
+* An IPv4 address in dotted notation (e.g. `192.168.1.50`).
+  The EPICS default port will be used, which is 5064.
+* A host name, including a port number (e.g. `mygateway.example.org:1234`).
+* A host name (e.g. `mygateway.example.org`).
+  The EPICS default port will be used, which is 5064.
+* If you need to specify multiple gateways, separate the entries by semicolon (e.g. `gw1.example.org:1234;gw2.example.org:9876;192.168.1.50`).
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniel J. Lauk</dc:creator><pubDate>Thu, 10 Jul 2014 13:57:44 -0000</pubDate><guid>https://sourceforge.net7681c98de86b4be1f4bacd18102d649d47473cf6</guid></item><item><title>client modified by Daniel J. Lauk</title><link>https://sourceforge.net/p/epicssharp/wiki/client/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="client-library"&gt;Client Library&lt;/h1&gt;
&lt;p&gt;NuGet package (binary only):&lt;br /&gt;
&lt;a href="https://www.nuget.org/packages/EpicsClient2" rel="nofollow"&gt;https://www.nuget.org/packages/EpicsClient2/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Download the client library here (client directory):&lt;br /&gt;
&lt;a href="https://sourceforge.net/p/epicssharp/code"&gt;https://sourceforge.net/p/epicssharp/code/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add the reference of the EpicsClient2 assembly to your project.&lt;/p&gt;
&lt;p&gt;To use it:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nx"&gt;EpicsClient&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;EpicsClient&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;client.Configuration.SearchAddress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"255.255.255.255:5064"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;channel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;client.CreateChannel&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"MY-EPICS-CHANNEL:VALUE"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;Console.WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;channel.Get&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;the client.Configuration.SearchAddress can be left out and it will then use the default EPICS search port on the local broadcast address. You can however specify one or more search addresses separated by semi-colons.&lt;/p&gt;
&lt;p&gt;To use monitors instead of get use the event MonitorChanged:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="nb"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Program&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;static&lt;/span&gt; &lt;span class="nx"&gt;EpicsChannel&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nx"&gt;static&lt;/span&gt; &lt;span class="bp"&gt;void&lt;/span&gt; &lt;span class="nx"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="err"&gt;[&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt; args)
    {
        EpicsClient client = new EpicsClient();
        client.Configuration.SearchAddress = "129.129.130.87:5432";

        channel = client.CreateChannel&lt;span class="nt"&gt;&amp;lt;string&amp;gt;&lt;/span&gt;("ADG1:IST1:2");
        channel.StatusChanged += new EpicsStatusDelegate(channel_StatusChanged);
        channel.MonitorChanged += new EpicsDelegate&lt;span class="nt"&gt;&amp;lt;string&amp;gt;&lt;/span&gt;(channel_MonitorChanged);

        Console.ReadKey();
    }

    static void channel_MonitorChanged(EpicsChannel&lt;span class="nt"&gt;&amp;lt;string&amp;gt;&lt;/span&gt; sender, string newValue)
    {
        Console.WriteLine("Value: " + newValue);
    }

    static void channel_StatusChanged(EpicsChannel sender, ChannelStatus newStatus)
    {
        Console.WriteLine("Status: " + newStatus.ToString());
    }
}
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;type += and then 2 tabs which will generate for you the skeleton callback function.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniel J. Lauk</dc:creator><pubDate>Thu, 10 Jul 2014 12:50:46 -0000</pubDate><guid>https://sourceforge.netdf7b4618dd9332b83045cfdf3623c583b004799c</guid></item></channel></rss>