Admin Production ni-theme
Current Publication

Specifying Network Stream Endpoint URLs

LabWindows/CVI

Specifying Network Stream Endpoint URLs

LabWindows/CVI identifies every network stream endpoint with a URL. When you specify a name for an endpoint with the endpointUrl parameter of the CNSNew...Endpoint functions, LabWindows/CVI uses that name to create a URL with the following syntax:

ni.dex://host_name:context_name/endpoint_name

The following table describes each component of this URL.

URL Component Description
ni.dex The protocol of the URL. The dex protocol identifies the URL as an endpoint URL.
host_name The DNS name or IP address of the computer on which the endpoint resides. The default value for this component is localhost, which routes to the network location of the computer on which the endpoint resides.
context_name A string value that refers to the application the endpoint resides in. This component is an empty string unless you specify a URL that includes a context name with the endpointUrl parameter of the CNSNew...Endpoint functions.
Note  Only one application on each computer can specify the default context. Therefore, if you have multiple applications, including LabVIEW applications, on a single computer that use network streams, you must assign a URL instead of a name to each endpoint in those applications.
endpoint_name The name that you assign to the endpoint with the endpointUrl parameter of the CNSNew...Endpoint functions.

To create a valid network stream, use endpoint URLs to prompt a writer and a reader endpoint to connect to each other. Perform this task by passing the URL of a remote endpoint to the otherEndpointUrl parameter of the CNSNew...Endpoint functions.

The URL you pass to the otherEndpointUrl parameter varies depending on the network location of the remote endpoint. The following sections show examples of prompting endpoints to connect to each other.

Note  Endpoint URLs are not case-sensitive. However, when you specify an endpoint URL, you must replace any reserved characters that you use with the corresponding escape codes to prevent errors.

Streaming to a Computer That Runs One Application Using Network Streams

When you connect to an endpoint on a remote computer that runs one application that uses network streams, as shown in the preceding figure, you must use a URL with the following syntax to prompt a connection between the endpoints:

endpoint_name

Complete the following steps to use a URL with this syntax to prompt a connection between two endpoints.

  1. Create a reader endpoint on the remote computer:

    CNSNewScalarEndpoint ("//10.0.0.62/Reader", "", CNSTypeInt8, 100, 0, CNSDirectionReader, CNSWaitForever, 0, &readerEndpoint);

    In this example, 10.0.0.62 is the host_name and Reader is the endpoint_name. Therefore, the URL of this endpoint is //10.0.0.62/Reader.
    Note  LabWindows/CVI searches for a valid interpretation of the host name in the following order:
    1. Target name (as specified in the LabWindows/CVI project)
    2. DNS name
    3. IP address
  2. Create a writer endpoint on the local host and specify the URL of the reader endpoint for the otherEndpointUrl parameter:

    CNSNewScalarEndpoint ("Writer", "//10.0.0.62/Reader", CNSTypeInt8, 100, 0, CNSDirectionWriter, CNSWaitForever, 0, &writerEndpoint);

Streaming to a Computer That Runs Multiple Applications Using Network Streams

When you connect to an endpoint on a remote computer that runs multiple applications that use network streams, as shown in the preceding figure, you must use a URL with the following syntax to prompt a connection between the endpoints:

//host_name:context_name/endpoint_name

Complete the following steps to use a URL with this syntax to prompt a connection between two endpoints.

  1. Create a reader endpoint on the remote computer:

    CNSNewScalarEndpoint ("//10.0.0.62:Application 2/Reader", "", CNSTypeInt8, 100, 0, CNSDirectionReader, CNSWaitForever, 0, &multReaderEndpoint);

    When you create an endpoint on a computer that runs multiple applications that use network streams, you must assign a URL that includes the host_name, a context_name, and an endpoint_name, as shown in the example. Assigning a URL instead of a name in this instance ensures that multiple applications on one computer do not use the same context, which would result in an error for the second application.
  2. Create a writer endpoint on the local host and specify the URL of the reader endpoint for the otherEndpointUrl parameter:

    CNSNewScalarEndpoint ("Writer", "//10.0.0.62:Application 2/Reader", CNSTypeInt8, 100, 0, CNSDirectionWriter, CNSWaitForever, 0, &multWriterEndpoint);

Streaming to an Application on the Local Host

When you connect to an endpoint within another application on the local host, as shown in the preceding figure, you must use a URL with the following syntax to prompt a connection between the endpoints:

//localhost:context_name/endpoint_name

Complete the following steps to use a URL with this syntax to prompt a connection between two endpoints.

  1. Create a reader endpoint within one application:

    CNSNewScalarEndpoint ("//localhost:Application 2/Reader", "", CNSTypeInt8, 100, 0, CNSDirectionReader, CNSWaitForever, 0, &localReaderEndpoint);
  2. Create a writer endpoint within the other application and specify the URL of the reader endpoint for the otherEndpointUrl parameter:

    CNSNewScalarEndpoint ("Writer", "//localhost:Application 2/Reader", CNSTypeInt8, 100, 0, CNSDirectionWriter, CNSWaitForever, 0, &localWriterEndpoint);

    Note  Because the local host runs two applications that use network streams, you must specify a URL instead of a name for each endpoint.