Try to change the CreateDLLInstance routine like below. There are 2 changes. I'm not able to test any of this, so I'm not 100% sure it will work as expected.
Private Sub CreateDLLInstance()
'* Still default, so ignore
If m_IPAddress = "0.0.0.0" Then Exit Sub
If DLL(0) IsNot Nothing Then
'* At least one DLL instance already exists,
'* so check to see if it has the same IP address
'* if so, reuse the instance, otherwise create a new one
Dim i As Integer
While DLL(i) IsNot Nothing AndAlso DLL(i).IPAddress <> m_IPAddress AndAlso DLL(i).TcpipPort <> m_TcpipPort AndAlso i < 11
i += 1
End While
MyDLLInstance = i
End If
If DLL(MyDLLInstance) Is Nothing Then
DLL(MyDLLInstance) = New MfgControl.AdvancedHMI.Drivers.ModbusTCP.ModbusTcpDataLinkLayer(m_IPAddress)
DLL(MyDLLInstance).TcpipPort = m_TcpipPort
AddHandler DLL(MyDLLInstance).DataReceived, AddressOf DataLinkLayer_DataReceived
AddHandler DLL(MyDLLInstance).ComError, AddressOf DataLinkLayer_ComError
End If
End Sub