Using OpcCmd Utility as OPC UA Client
From OPC Labs Knowledge Base
For general information about the OpcCmd tool, see Category:OpcCmd Utility.
Commands, Arguments and Options
Command: uaClient browse
Setting a "browse chunk" size:
uaClient set IsolatedParameters.SessionParameters.MaximumReferencesPerBrowseNode [Int32]400 browse opc.tcp://localhost:49320 nsu=KEPServerEX;ns=2;s=Simulation.Functions
Command: uaClient subscribe
OpcCmd -i uaClient subscribe opc.tcp://opcua.demo-this.com:51210/UA/SampleServer nsu=http://test.org/UA/Data/;i=10849
Obtaining server condition statistics:
- Enter
uaClient --ConnectionMonitoring
. - Enter
subscribe opc.tcp://opcua.demo-this.com:51210/UA/SampleServer nsu=http://test.org/UA/Data/;i=10849
. - Optionally terminate the command prematurely by pressing X.
- Wait for approx. 10 seconds.
- Enter
events?
, or shortened:ev?
. Note the index of the last event (in the "[]" column). - Enter
events? --!extractElement <nn> --!extractMember EventArgs.Statistics.StateDictionary
, or shortened:ev? -!xe <nn> -!xm EventArgs.Statistics.StateDictionary
where <nn> is the index of the last event, taken in previous step.
Sample output:
Events (extracting: element 77, member 'eventargs.statistics.statedictionary') (sequence): 5 element(s) ╒═════════════╤═════╤════════════╤════════════╤════════════╤══════════════════╤════════════╤═══════════════════╤══════════════════╤══════════════════╤══════════════════╤══════════════════╕ │[] │Enter│First Enter │Last Cycle │Last Cycle │Last Cycle Time │Last Enter │Current Active Time│Accumulated Time │Minimum Time Span │Average Time Span │Maximum Time Span │ │ │Count│Time Local │Enter Time │Leave Time │Span │Time Local │Span │Span │ │ │ │ │ │ │ │Local │Local │ │ │ │ │ │ │ │ ╞═════════════╪═════╪════════════╪════════════╪════════════╪══════════════════╪════════════╪═══════════════════╪══════════════════╪══════════════════╪══════════════════╪══════════════════╡ │Connected │ 1│18:21:30.691│18:21:30.691│18:22:52.225│0:00:01:21.5320000│18:21:30.691│0:00:00:00.0000000 │0:00:01:21.5320000│0:00:01:21.5320000│0:00:01:21.5320000│0:00:01:21.5320000│ │Connecting │ 1│18:21:29.928│18:21:29.928│18:21:30.691│0:00:00:00.7650000│18:21:29.928│0:00:00:00.0000000 │0:00:00:00.7650000│0:00:00:00.7650000│0:00:00:00.7650000│0:00:00:00.7650000│ │Disconnected │ 2│18:21:29.841│18:21:29.841│18:21:29.928│0:00:00:00.0780000│18:22:52.400│0:00:00:00.0000000 │0:00:00:00.0780000│0:00:00:00.0780000│0:00:00:00.0780000│0:00:00:00.0780000│ │Disconnecting│ 1│18:22:52.225│18:22:52.225│18:22:52.400│0:00:00:00.1870000│18:22:52.225│0:00:00:00.0000000 │0:00:00:00.1870000│0:00:00:00.1870000│0:00:00:00.1870000│0:00:00:00.1870000│ │Unconnected │ 2│18:21:29.841│18:21:29.841│18:21:30.691│0:00:00:00.8430000│18:22:52.225│0:00:00:00.1870000 │0:00:00:00.8430000│0:00:00:00.8430000│0:00:00:00.8430000│0:00:00:00.8430000│ ╘═════════════╧═════╧════════════╧════════════╧════════════╧══════════════════╧════════════╧═══════════════════╧══════════════════╧══════════════════╧══════════════════╧══════════════════╛