Dim ads As TcAdsClient = New TcAdsClient ads.Connect(netID, Int32.Parse(port)) 'default port of Twincat 3 is 851 / Twincat 2 is 801 If ads.IsConnected = True Then WriteLine("Connection ok" & vbCrLf) Else WriteLine("Connection error") End If
Imports TwinCAT.Ads Private port As Integer = My.Settings.port Private netID As String = My.Settings.netID Sub Main() Call ADSFunction() End Sub Public Sub ADSFunction() Dim ads As TcAdsClient = New TcAdsClient Try ads.Connect(Int32.Parse(801)) 'default port of Twincat 3 is 851 / Twincat 2 is 801 If ads.IsConnected = True Then WriteLine("Connection ok" & vbCrLf) Else WriteLine("Connection error") Exit Sub End If Catch ex As Exception WriteLine(ex.ToString) End Try 'ads.Dispose() End Sub
TwinCAT.Ads.AdsErrorException: Ads-Error 0x748 : Port is not open. (Ads-Error 0x748 : Port is not open.) at TwinCAT.Ads.Internal.TcLocalSystem..ctor() at TwinCAT.Ads.Internal.TcLocalSystem.GetInstance() at TwinCAT.Ads.TcAdsClient.Connect(Int32 srvPort) at STREAM_Monitoring_System.Module1.ADSFunction() in C:\Users\User\source\repos\STREAM Monitoring System\STREAM Monitoring System\Module1.vb:line 156
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)