Using Remote Sessions

This section provides guidelines to using remote SICL sessions, including:

Addressing Guidelines

Communicating with a device over a LAN via a TCP/IP or remote GPIB, USB, or serial interface preserves the functionality of the gatewayed interface, with a few exceptions. Thus, most operations over a local interface (such as GPIB connected directly to your controller) can also be performed over a remote interface.

The only portions of your application that must be changed are the addresses passed to the iopen calls (unless you use aliases or store those addresses in a configuration file, in which case no changes to the application itself are required). The address used for a local interface must have a LAN prefix added so the SICL software knows to direct the request to a LAN server on the network.

Creating a Remote Session

To create a remote session (also called a LAN-gatewayed session), specify the LAN’s interface logical unit or interface ID, the IP address or hostname of the server machine, and the address of the remote interface or device in the addr parameter of the iopen function. The interface logical unit and interface ID are defined in Connection Expert.

Example: Remote Addressing

Some examples of remote SICL addresses follow. If you are using the IP address rather than the hostname of the server machine, you must use the bracket (not the comma) notation.

lan,128.10.0.3:gpib  (Incorrect)
lan[128.10.0.3]:gpib  (Correct)

Examples of LAN Addressing

Address

Description

lan[instserv]:GPIB,7

A device address corresponding to the device at primary address 7 on the GPIB interface attached to the machine named instserv. The default LAN protocol set when the LAN interface was configured with Connection Expert will be used.

lan;vxi-11[instserv]:GPIB,7

A device address corresponding to the device at primary address 7 on the GPIB interface attached to the machine named instserv. The VXI-11 protocol (TCP/IP Instrument protocol) will be used.

lan;sicl-lan [instserv]:GPIB,7

A device address corresponding to the device at primary address 7 on the GPIB interface attached to a machine named instserv. The SICL-LAN protocol will be used.

lan;auto[instserv]:GPIB,7

A device address corresponding to the device at primary address 7 on the GPIB interface attached to a machine named instserv. The SICL-LAN protocol will be used if the server supports it. Otherwise, the VXI-11protocol will be used.

lan;default[instserv]:GPIB,7

A device address corresponding to the device at primary address 7 on the GPIB interface attached to a machine named instserv. The default LAN protocol set when the lan interface was configured with Connection Expert will be used. This is the same as not specifying a protocol.

lan[instserv.keysight.com]:gpib,7

A device address corresponding to the device at primary address 7 on the gpib interface attached to the machine named instserv in the keysight.com domain. (Fully qualified domain names may be used.)

lan1[128.10.0.3]:GPIB0,3,2

A device address corresponding to the device at primary address 3, secondary address 2, on the GPIB0 interface attached to the machine with IP address 128.10.0.3.

lan1[instserv]:GPIB2

An interface address corresponding to the GPIB2 interface attached to the machine named instserv.

30,instserv:gpib,3,2

A device address corresponding to the device at primary address 3, secondary address 2, on the gpib interface attached to the machine named instserv. (30 is the default logical unit for LAN.)

lan[instserv]:GPIB,cmdr

A commander session with the GPIB interface attached to the machine named instserv (assuming the server supports GPIB commander sessions).

lan[instserv]:COM1

An interface address corresponding to the RS-232 COM1 interface attached to the machine named instserv.

lan[instserv]:COM1,488

A device address corresponding to an RS-232 device attached to the machine named instserv.

lan[instserv]:usb0[2391::1031::SN_041001::0]

A device address corresponding to a USB device attached to the machine named instserv.

lan[instserv]:UsbDevice1

A device address corresponding to a USB device attached to the machine named instserv. The alias name UsbDevice1 is defined on the machine named instserv.

SICL Function Support

This table shows the relationship between the address passed to iopen, the session type returned by igetsesstype, the interface type returned by igetintftype, and the value returned by igetgatewaytype.

Relationships Between SICL Functions

Address

Session Type

Interface Type (VXI-11 Protocol)

Interface Type (SICL-LAN Protocol)

Gateway Type

lan

I_SESS_INTF

I_INTF_LAN

I_INTF_NONE

I_INTF_NONE

lan[instserv]:inst0

I_SESS_DEV

I_INTF_LAN

I_INTF_USRDEF

I_INTF_LAN

lan[instserv]:gpib0

I_SESS_INTF

I_INTF_GPIB

I_INTF_GPIB

I_INTF_LAN

lan[instserv]:gpib0,7

I_SESS_DEV

I_INTF_GPIB

I_INTF_GPIB

I_INTF_LAN

gpib0

I_SESS_INTF

I_INTF_GPIB

I_INTF_GPIB

I_INTF_NONE

gpib0,7

I_SESS_DEV

I_INTF_GPIB

I_INTF_GPIB

I_INTF_NONE

Remote Interface Support

A gatewayed session to a remote interface provides the same SICL function support as if the interface were local, with the following exceptions or qualifications.

Exceptions to Remote Interface Support

Type of Functions

SICL Functions NOT Supported

SICL functions not supported over LAN using either protocol

iblockcopy, imap, imapinfo, ipeek, ipoke, ipopfifo, ipushfifo, iunmap, iblockmovex, imapx, iunmapx, ipeekx, ipokex, iunmapx

SICL functions, in addition to those listed above, not supported with the VXI-11 protocol

All RS-232/serial specific functions

igetlu, ionintr, isetintr, igetintfsess, igetonintr, igpibgett1delay, igpibppoll,

igpibppollconfig, igpibppollresp, igpibsett1delay

For the igetdevaddr, igetintftype, and igetsesstype functions to be supported with the VXI-11 (TCP/IP instrument protocol), the remote address strings must follow the VXI-11 naming conventions – gpib0, gpib1, etc. For example:

gpib0,7
gpib1,7,2
gpib2
vxi0, vxi1, etc. (for example: vxi0,8 or vxi0)

However, since the interface IDs at the remote server may be configurable, this conformance is not guaranteed. Correct behavior of iremote and iclear depend on the correct address strings being used. When iremote is executed over the VXI-11 protocol, iremote sends the LLO (local lockout) message in addition to placing the device in the remote state.

LAN Timeout Functions

Any of the following functions may time out over LAN, even those functions that cannot time out over local interfaces. (See Using Locks, Threads, and Timeouts for more details.) These functions all cause a request to be sent to the server for execution:

  • All GPIB-specific functions
  • All RS-232/serial-specific functions
  • iabort, iclear, iclose, iflush, ifread, ifwrite, igetintfsess, ilocal, ilock, ionintr, ionsrq, iopen, iprintf, ipromptf, iread, ireadstb, iremote, iscanf, isetbuf, isetintr, isetstb, isetubuf, itrigger, iunlock, iversion, iwrite, ixtrig

The following SICL functions perform as follows with LAN-gatewayed sessions.

How SICL Functions Perform for LAN Gatewayed Devices

idrvrversion

Returns the version numbers from the server.

iwrite, iread

actualcnt may be reported as 0 when some bytes were transferred to or from the device by the server. This can happen if the client times out while the server is in the middle of an I/O operation.

Sample Programs

Two sample programs for LAN-gatewayed sessions follow, one for C and one for Visual Basic 6.0.

Sample: LAN-gatewayed Session (C)

This sample program opens a GPIB device session via a LAN-to-GPIB gateway. This sample is the same as the sample in topic 4 - Using SICL with GPIB, except the addresses passed to the iopen calls are modified. The addresses in this sample assume a machine with hostname instserv is acting as a LAN-to-GPIB gateway.

/* landev.c
This example program sends a scan list to a switch and, while looping, closes channels and takes measurements.*/


#include <sicl.h>
#include <stdio.h>

main() {

INST dvm;
INST sw;
double res;
int i;

/* Print message and terminate on error */
ionerror (I_ERROR_EXIT);

/* Open the multimeter and switch sessions */
dvm = iopen (“lan[instserv]:gpib0,9,3”);
sw = iopen (“lan[instserv]:gpib0,9,14”);
itimeout (dvm, 10000);
itimeout (sw, 10000);

/*Set up trigger*/
iprintf (sw, “TRIG:SOUR BUS\n”);

/*Set up scan list*/
iprintf (sw,”SCAN (@100:103)\n”);
iprintf (sw,”INIT\n”);

for (i=1;i<=4;i++) {
/* Take a measurement */
iprintf (dvm,”MEAS:VOLT:DC?\n”);

/* Read the results */
iscanf (dvm,”%lf”, &res);

/* Print the results */
printf (“Result is %f\n”,res);
/*Trigger to close channel*/
iprintf (sw, “TRIG\n”);
}

/* Close the multimeter and switch sessions */
iclose (dvm);
iclose (sw);
}

Sample: LAN-gatewayed Session (Visual Basic 6.0)

This section contains information specific to the Windows product.

This sample program opens a GPIB device session via a LAN-to-GPIB gateway.

Option Explicit
'''''''''''''''''''''''''''''''''''''''''''''''
' landev.bas
' This example program opens a GPIB device
‘ session via a LAN-to-GPIB gateway. The
‘ addresses in this example assume a machine
‘ with hostname 'instserv' is acting as a
‘ LAN-to-GPIB gateway.
'''''''''''''''''''''''''''''''''''''''''''''''

Sub Main()

Dim dvm As Integer, sw As Integer
Dim nargs As Integer, I As Integer
Dim actual As Long
Dim res As String * 20

  ' Set up an error handler within this
‘ subroutine that will get called if a SICL
  ' error occurs.

On Error GoTo ErrorHandler

‘Open the multimeter and switch sessions
dvm = iopen("lan[intserv]:gpib0,9,3")
sw = iopen("lan[intserv]:gpib0,9,14")
Call itimeout(dvm, 10000)
Call itimeout(sw, 10000)

' set up the trigger
nargs = iwrite(sw, "TRIG:SOUR BUS" + Chr$(10)
+ Chr$(0), 14, 1, actual)

' set up scan list
nargs = iwrite(sw, "SCAN (@100:103)" +
Chr$(10) + Chr$(0), 15, 1, actual)
nargs = iwrite(sw, "INIT" + Chr$(10) +
Chr$(0), 5, 1, actual)

For I = 1 To 4 Step 1
' Take a measurement
nargs = iwrite(dvm, "MEAS:VOLT:DC?" +
Chr$(10)+ Chr$(0), 14, 1, actual)

' Read the results
nargs = iread(dvm, res, 20, 0&, actual)

‘ Print the results
MsgBox "Channel " & I & " result: " + res &
vbCrLf

' Trigger switch
nargs = iwrite(sw, "TRIG" + Chr$(10) +
Chr$(0), 5, 1, actual)
Next I

Call iclose(dvm)
Call iclose(sw)

Exit Sub

ErrorHandler:

' Display the error message in the txtResponse
‘ TextBox.

MsgBox "*** Error : " + Error$

' Close the device session if iopen was
‘ successful.

If dvm <> 0 Then
Call iclose(dvm)
End If

If sw <> 0 Then
Call iclose(sw)
End If

End Sub