![]() |
Connect()








Public Function |
Declared in: NiBinding.h |
Declaration
void Connect( LPCTSTR URL, AccessModes accessMode);
Description
Connects the CNiBinding object to a data source or target. This function uses the specified values of the URL and AccessMode properties to establish the connection.
Notes:
1. The CNiBinding object creates the connection asynchronously. You must return control to your application's message loop after you create the connection and before you perform read or write operations on the CNiBinding object's data or attributes. You can check the CNiBinding object's Status property to determine when the connection is established.
2. When you call Connect on a CNiBinding object that you configured for reading, the CNiBinding object updates its Data property when the connection is established.
3. When you call Connect on a CNiBinding object that you configured for writing, the CNiDataSocket writes the value of its Data property to the server when the connection is established.
Parameters
URL of the data source or target to which to connect.
Specifies the access mode for the connection.
Pass one of the values listed below.
- CNiBinding::Read - read once when you establish the connection. Call the Update function to cause subsequent reads.
- CNiBinding::ReadAutoUpdate - read once when you establish the connection and automatically read again when the data at the data source is updated. This mode is valid only for DSTP and logos data sources.
- CNiBinding::Write - write the data once when you establish the connection. Call the Update function to cause subsequent writes.
- CNiBinding::WriteAutoUpdate - write the data once when you establish the connection. The CNiDataSocket object writes the data automatically when the value or any attribute changes. This mode is valid only for DSTP and logos data targets.