Keysight VISA.NET Help
Resources and Sessions

Resources and Sessions

A session in VISA.NET creates and manages a communication channel to I/O hardware, or to an instrument (or other device) via I/O hardware. Sessions are specific to the type of connection being used (for example, GPIB, PXI, or USB). Sessions can also be specific to a connection to an attached device via an I/O protocol (for example, a PXI session) or something that manages aspects of the connection (for example, a PXI backplane).

 

In the VISA.NET API, a session is an instance of a VISA.NET class that is used to communicate with a specific resource. VISA.NET programs create sessions to connect to instruments, interfaces, and other types of resources. A session is unique to a specific resource. (There may be multiple active sessions for a given resource on the same PC at a time, though this is not recommended.)

Each session interface includes some elements that are common to all sessions. These elements are defined in the interface IVisaSession.  All VISA.NET session interfaces ultimately derive from IVisaSession, and so include this common functionality.

All session interfaces are either message-based or register-based. All message-based session interfaces include some elements common to all message-based sessions. These elements are defined in the interface IMessageBasedSession. All VISA.NET message-based session interfaces derive from IMessageBasedSession, and so include this common functionality.

Likewise, all register-based session interfaces include some elements common to all register-based sessions. These elements are defined in the interface IRegisterBasedSession.  All VISA.NET register-based session interfaces derive from IRegisterBasedSession, and so include this common functionality.

One session interface, IVxiSession, derives from both IMessageBasedSession and IRegisterBasedSession, but an actual VXI hardware interface connection only uses one or the other.

Resource Descriptors

Resource descriptors (also called VISA addresses) contain all of the information necessary to uniquely identify each hardware resource connected to a given PC. Resource descriptors begin with an I/O protocol (called a hardware interface type) and interface number followed by "::", and end with "::" followed by a resource class. The information between the first and last "::" uniquely identifies the hardware within the hardware interface type and the resource class. The hardware interface type and interface number together are also called the interface ID.

For example, the resource descriptor for a GPIB instrument might be "GPIB0::11::0::INSTR". In this case, GPIB is the hardware interface type, 0 is the hardware interface number, and INSTR is the resource class. 11::0 uniquely identifies an instrument connected to the GPIB0 interface.

The standard VISA.NET hardware interface types are listed below. The interface type is followed by an interface number in the resource descriptor. If no interface number is included, the default of 0 (zero) is assumed.

The standard VISA.NET resource classes are

Resource Descriptor Examples

The table below shows the syntax for some common resource descriptor formats, with examples.

Interface

Syntax / Examples

ASRL

ASRL[board][::INSTR]

ASRL1::INSTR

GPIB

GPIB[board]::primary address[::secondary address][::INSTR]

GPIB0::18::INSTR

TCPIP

TCPIP[board]::host address[::LAN device name]::INSTR

TCPIP0::127.0.0.1::INSTR

TCPIP SOCKET

TCPIP[board]::host address::port::SOCKET

TCPIP0::127.0.0.1::5025::SOCKET

USB

USB[board]::mfgID::model::ser#[::USB intfc#][::INSTR]

USB0::2391::291::SN_001001::INSTR

PXI

PXI[bus]::device[::function][::INSTR]

PXI1::5::INSTR

Session Types

VISA.NET defines session interfaces for combinations of an I/O protocol and a resource class. This table shows whether each interface derives from IMessageBasedSession or IRegisterBasedSession, and also shows the derivation from IVisaSession. For example, in the first line, ISerialSession derives from IMessageBasedSession, which derives from IVisaSession.

Protocol

Resource Class

Interface

ASRL

INSTR

ISerialSession : IMessageBasedSession : IVisaSession

GPIB

INSTR

IGpibSession : IMessageBasedSession : IVisaSession

GPIB

INTFC

IGpibInterfaceSession : IVisaSession

PXI

INSTR

IPxiSession : IRegisterBasedSession : IVisaSession

PXI

BACKPLANE

IPxiBackplaneSession : IVisaSession

PXI

MEMACC

IPxiMemorySession : IRegisterBasedSession : IVisaSession

TCPIP

INSTR

ITcpipSession : IMessageBasedSession : IVisaSession

TCPIP

SOCKET

ITcpipSocketSession : IMessageBasedSession : IVisaSession

USB

INSTR

IUsbSession : IMessageBasedSession : IVisaSession

VXI

INSTR

IVxiSession : IMessageBasedSession : IVisaSession

VXI

BACKPLANE

IVxiBackplaneSession : IVisaSession

VXI

MEMACC

IVxiMemorySession : IRegisterBasedSession : IVisaSession

Session Classes

Keysight VISA.NET includes session classes, which implement session interfaces. There is a class for each session interface listed in the table above.

Your program can instantiate a session class directly or use a ResourceManager to instantiate it. The ResourceManager.Open method accepts a Resource Descriptor argument, which identifies both a session type and a specific device for the connection.  The Global Resource Manager (GRM) has similar functionality.

For more information on using a resource manager to instantiate sessions, refer to Resource Managers and the GRM.

Once a program has used a resource manager to instantiate a session class, all of the functionality supported by the implemented session interfaces will be available to the program.

 

 


© Keysight Technologies 2015-2025