StreamLink.NET
Running Examples in Visual Studio

Running Examples in Visual Studio

Example code is available in the StreamLinkExamples.zip file stored at C:\Program Files\Caplin Systems Ltd\StreamLink.NET\examples within the installed distribution.

Extract the contents of this file to a suitable location on your system.

Within the top level folder of the unzipped file there is a Visual Studio project file, StreamLinkExamples.csproj. Open this file using Visual Studio (2005 or 2008).

When Visual Studio first loads the project it will popup a message box saying

You should answer Yes.

(Note: If you have the Perforce source control system installed then you will receive different message dialogs, but again the source control system should be disabled).

Adding a Reference to the StreamLink DLL

Before you can run the examples you will need to correct the project references to point to the Streamlink.Net dll.

In the solution explorer expand the References within the StreamLinkExamples project.

Remove the reference to Caplin.Streamlink (by right clicking and choosing Remove)

Then right click on the References folder and choose 'Add Reference'

Click on the 'Browse' tab and then navigate to the following file C:\Program Files\Caplin Systems Ltd\StreamLink.NET\bin\Caplin.StreamLink.dll

Setting StreamLink DLL to "Copy Local"

Once the StreamLink dll has been referenced you need to change its "Copy Local"  property to True:

Right click on the Caplin.StreamLink reference and choose the "Properties" option.

Then Change the 'Copy Local' property to True:

Running the ExampleRunner Application

You are now ready to build and run the examples.

The entry point for the StreamLinkExamples project is the ExampleRunner class in ExampleRunner.cs. This is a Windows Forms GUI that allows four of the examples to be run directly and their output to be redirected to an Output window.

Try the "Command Line Application" first by choosing it from the drop down list of Applications and then pressing the "Start Application" button. The list of available commands is shown in the Output window.

Type:

Login <Hostname> <port> <username> <password>

where you replace the <> values with your Liberator/ and user details.

Once you are logged in, you can use the other commands to subscribe to subjects and /unsubscribe from them. (To see the list of available commands again, type Help)


To run the other examples from the dropdown you will need to modify the application configuration file, App.config, to point to your own Liberator server(s).

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="MockConfiguration"
             type="Caplin.StreamLink.Protocol.Mock.Configuration.MockConfigurationHandler,Caplin.StreamLink"/>
    <section name="RttpConfiguration"
             type="Caplin.StreamLink.Protocol.Rttp.Configuration.RttpConfigurationHandler,Caplin.StreamLink"/>
  </configSections>

  <!-- Comment out the following line to use the RttpConfiguration -->
  <!--MockConfiguration /-->

  <RttpConfiguration>
    <RttpService Name="Example RTTP Service">

      <Connections>
        <Type2Connection Protocol="Http" Port="8080"/>
      </Connections>

      <!-- N -->
      <ServerGroup Type="order">
        <ServerGroup Type="order">
          <Server Name="Primary London Server" Address="localvm"/>
          <Server Name="Backup London Server" Address="localvm"/>
        </ServerGroup>
        <ServerGroup Type="order">
          <Server Name="Primary London Server 2" Address="dominicm2.caplin5.com"/>
          <Server Name="Backup London Server 2" Address="localvm"/>
        </ServerGroup>
      </ServerGroup>

    </RttpService>
  </RttpConfiguration>

</configuration>