Ldv_read(), Syntax – Echelon OpenLDV User Manual

Page 35

Advertising
background image

OpenLDV Programmer’s Guide

27

For local network interfaces, after the ldv_open_cap() function returns the

LDV_OK success code, the network interface device has been initialized (see

below for information about remote network interfaces). For some network

interface types, the network interface enters an initial quiet mode (flush state)

after reset. To start using the network interface, the OpenLDV application must

cancel the quiet mode with the niFLUSH_CANCEL immediate network

interface command. For more information about immediate commands, see

Immediate Commands on page 77.
Each successful ldv_open(), ldv_open_cap(), or ldvx_open() call (including

nested ones) must have a matching ldv_close() call.
For xDriver-based remote network interfaces that use the xDriver default lookup

extension, the name specified as the szDevice parameter should match an entry

created for a device with the L

ON

W

ORKS

Interfaces application in the Windows

Control Panel. See Chapter 5, Using the xDriver Default Profile, on page 93, for

more information. For xDriver-based remote network interfaces that use a

custom (non-default) xDriver profile with a custom lookup extension, the name

specified as the id parameter must exist in the custom database. See Chapter 6,

Extending xDriver, on page 99, for more information.
If you do not specify a valid network interface name as the szDevice parameter

when you call this function, or if the network interface referenced by the szDevice

parameter cannot be found, the LDV_INVALID_DEVICE_ID or

LDVX_INVALID_XDRIVER return code is returned.
Each network interface can only be part of one OpenLDV session at a time on a

particular computer. If you call this function for a network interface that is being

used by another process on your computer, the function will fail, and the

LDV_ACCESS_DENIED return code is returned.
If you use xDriver to open a remote network interface while a remote client on

another computer is using it, the call to ldv_open_cap() might initially appear

to succeed. However, when you call ldv_read() or ldv_write() to read or write a

message to the network interface later, the LDVX_READ_FAILED or

LDVX_WRITE_FAILED failure code is returned, indicating that the session has

failed. The timing of the failure depends on the setting of the Synchronous

Timeout field of the xDriver profile that is handling the session, as well as the

setting of the TcpMaxConnectRetransmissions parameter on the computer

that is running the application. For more information about xDriver profiles, see

xDriver Profiles on page 134.

ldv_read()

Call this function to read an uplink message from a network interface.

Syntax

LDVCode ldv_read(

LdvHandle handle,

PVOID msg_p,

SHORT len

)

Advertising