Initializing an independent client – Echelon LNS User Manual

Page 74

Advertising
background image

LNS Programmer's Guide

60

2. If this is the first time the network will be opened on the PC running your

application, use the Networks collection object's Add() method to save

the network's name, IP address, and port (identified by the database

path) into the Windows Registry on the remote PC. In this case, the final
createDatabase parameter you supply to the Add method must be set

to True.

Dim MyNetwork as LcaNetwork

Set MyNetwork = MyNetworks.Add("Building 75", _

"lns://bldgServer.acme.com:2540", True)

Note that the database path supplied to the Add() method contains a

URL containing the LNS Lightweight client protocol name (“lns://”), the

server’s IP address (“bldgServer.acme.com”, or “10.1.2.3” for a fixed IP
address), and the port on which the LNS Server listens for Lightweight

clients (“:2540”).

If the network to be opened has already been opened on the PC running
your application, get the Network object from the Networks collection.

You can iterate through the Networks collection to list all available

networks, or you can specify the network to be opened by its name.

Dim MyNetwork as LcaNetwork
Set MyNetwork = MyNetworks.Item("Building 75")

3. Call

the

Network object’s Open() method to open the LNS network

database. The LNS Server utility must be running on the PC containing
the LNS network database, or the operation will fail.

MyNetwork.Open()

4. Once you have opened a network, you should follow the tasks described in

the Opening a System section later in this chapter to configure and open

the system.

Initializing an Independent Client

As described in Chapter 3, you can use Independent client applications to open networks

in server-independent mode. You should note that only networks that have been

previously opened by a Local or Full client application using your application’s Network
Service Device can be opened in server-independent mode. To open a network in server-

independent mode, follow these steps:

1. Set the access and licensing modes for the Independent client application

and open the ObjectServer object as you would with a Local or Full

client application. For more information on these tasks, see Initializing a
Local Client Application
o
n page 48.

Note that when opening a network with an Independent client

application, you cannot select a new network interface, as you can with

other client types. LNS will open the network using the same network
interface as the last Local or Full client application that opened the

network.

2. Select a network from the ObjectServer object's VNINetworks

collection. The VNINetworks collection contains all networks that have

Advertising