Twincat 2.0 ADS VB.NET client

shakreeelmi

Member
Join Date
Mar 2019
Location
Kuala Lumpur
Posts
3
Hello,

I'm currently trying to connect my vb.net application with my Twincat PLC. This is what I have so far (i call it from a sub):

Code:
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

Now whenever I try to connect to the PLC, it says "Port not open". Weird is, I'm able to control my PLC through the Twincat PLC software using the same port. Please advise me on this matter. Thank you.
 
Is your TwinCAT run time on the same PC you are running the VB application? If so, try setting the netID to an empty string.

Hello Archie,

Thanks for the reply.

To answer your question, yes. The VB application is running on the same PC as my TwinCAT. Following to your suggestion, I've already tried with empty netID string. Following are some of the thing's I've tried:

-ads.Connect("", Int32.Parse(801))
-ads.Connect(Int32.Parse(801))
-ads.Connect(801)

But no luck :confused:

I have a question, do I need to open any port on either my pc or the beckhoff plc? For example 801, or I've read some where in the manual to open incoming port 48898 TCP and 48899 UDP, is this necessary?

Please further advise on this matter. Thank you.
 
I have a question, do I need to open any port on either my pc or the beckhoff plc? For example 801, or I've read some where in the manual to open incoming port 48898 TCP and 48899 UDP, is this necessary?
Since you are communicating with a run time that is on the same PC, you should not have to open any ports. You could try a Wireshark capture using the loopback adapter to see if that gives you any more clues.

Have you tried the sample app for AMS communications from Beckhoff?
 
Since you are communicating with a run time that is on the same PC, you should not have to open any ports. You could try a Wireshark capture using the loopback adapter to see if that gives you any more clues.

Have you tried the sample app for AMS communications from Beckhoff?

I'm not familiar with Wireshark application. Yes, as mentioned below, I've tried with tarik1978 suggestion. Still showing the same error.


The example is interesting. Unfortunately it gives the same error which is "Ads-Error 0x748 : Port is not open." 🔨
 
Hello Archie,

Thanks for the reply.

To answer your question, yes. The VB application is running on the same PC as my TwinCAT. Following to your suggestion, I've already tried with empty netID string. Following are some of the thing's I've tried:

-ads.Connect("", Int32.Parse(801))
-ads.Connect(Int32.Parse(801))
-ads.Connect(801)

But no luck :confused:

I have a question, do I need to open any port on either my pc or the beckhoff plc? For example 801, or I've read some where in the manual to open incoming port 48898 TCP and 48899 UDP, is this necessary?

Please further advise on this matter. Thank you.


If you are running the TwinCAT PLC and the VB application on the same PC, you should not need to open any ports. However, if the TwinCAT PLC is on a different PC, you will need to open port 801 on the TwinCAT PLC PC. You may also need to open incoming ports 48898 TCP and 48899 UDP on the TwinCAT PLC PC, but this is not always necessary. I know this is an old discussion. Appealing to the admin. Please approve my post,Thanks
 

Similar Topics

Hello. I am trying to do some basic file operations (move file from one folder to another, rename file in the new folder etc) and usually I just...
Replies
1
Views
2,179
Hello: I have a TwinCAT embedded PLC and for years I was able to access it through the AMS NetID. Recently updated Windows 10 and I was not able...
Replies
6
Views
16,116
Hey i want to read structures with an ads connecton with a c# programm. But i dont know how this works. can anyone help me Thanks
Replies
1
Views
2,113
Hi I worked three days ago twincat3 was working well. Today I am getting an error : Error 15 02/11/2017 23:33:54 223 ms | 'TwinCAT System'...
Replies
0
Views
5,540
I want to read variables from the PLC with my C# programm. Is it possible to run my c# programm on a computer without the TwinCat System...
Replies
2
Views
2,788
Back
Top Bottom