Author Topic: DataLinkLayerComError NullReferenceException  (Read 1353 times)

WellsCPak

  • Newbie
  • *
  • Posts: 28
    • View Profile
DataLinkLayerComError NullReferenceException
« on: June 18, 2015, 09:15:25 AM »
e.ErrorId = -34
e.ErrorMessage = "Could not connect to 0.0.0.0, port 44818. Timed out"

It seems to stop throwing exceptions here after adding a line to the beginning of this sub (line 1401)
Code: [Select]
If e.ErrorId = -34 Then Exit Sub
Seems like more of a band-aid fix than anything, since I don't understand why it's trying to connect to 0.0.0.0...

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: DataLinkLayerComError NullReferenceException
« Reply #1 on: June 18, 2015, 09:57:01 AM »
I think that line of code should not have the "(0)" on it and appear like this:

        If Requests(e.TransactionNumber And 255) IsNot Nothing Then

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: DataLinkLayerComError NullReferenceException
« Reply #2 on: June 18, 2015, 10:00:27 AM »
So technically it should be this

        If Requests(e.TransactionNumber And 255) IsNot Nothing AndAlso Requests(e.TransactionNumber And 255).Count > 0 Then

WellsCPak

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: DataLinkLayerComError NullReferenceException
« Reply #3 on: June 18, 2015, 03:34:12 PM »
I changed that line, and the Null Ref Exception moved to the OnComError sub instead...

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: DataLinkLayerComError NullReferenceException
« Reply #4 on: June 18, 2015, 05:02:08 PM »
It should be basically the same changes in that sub:

            If Requests(e.TransactionNumber And 255) IsNot Nothing AndAlso Requests(e.TransactionNumber And 255).Count > 0 Then
                Requests(e.TransactionNumber And 255)(0).Response = e
                waitHandle(e.TransactionNumber And 255).Set()
            End If