Ok.. I understand now why I'm getting -20 instead of the error the tag is invalid. I went through the EthernetIPforCLXComm source and found that in the Subroutine 'DataLinkLayer_DataReceived' a comparison is made to see if the data received was an internal request. A ReadSynchronus call is sent with the InternalRequest property set to false.
The code that is being run when this occurs is below:
'*****************************
'* Failed Status was returned
'*****************************
Dim d() As String = {DecodeMessage(StatusByte) & " CIP Status " & StatusByte}
If Not PLCAddressByTNS(e.TransactionNumber And 255).InternalRequest Then
If Not DisableEvent Then
Dim x As New MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs(d, PLCAddressByTNS(e.TransactionNumber And 255).TagName, e.TransactionNumber And 255)
If m_SynchronizingObject IsNot Nothing Then
Dim Parameters() As Object = {Me, x}
m_SynchronizingObject.BeginInvoke(drsd, Parameters)
Else
'TODO : This should raise the Com Error event
RaiseEvent DataReceived(Me, x)
End If
End If
Else
For i As Integer = 0 To SubscriptionList.Count - 1
If SubscriptionList(i).PLCAddress.TagName = PLCAddressByTNS(e.TransactionNumber And 255).TagName Then
m_SynchronizingObject.BeginInvoke(SubscriptionList(i).dlgCallBack, New Object() {d})
End If
Next
End If
The lines in Green are the code that is being evaluated when I receive the -20 error. Ultimately, it seems to me different information is returned when the request is external vs an internal request. The question is then, how do I get a more detailed reason of why the read failed? Can this be done just by making the Internal Request Property True?