BC9000 Beckhoff / TwinCAT


Thread Starter


I use the BC9000 Beckhoff for home automation. There are a few things which doesn't work:
Email function --> TWINCAT has a library SMTP, which makes it possible to send my via the beckhoff.

My plc is connected to my router and is fully functional via the router, but sending is not possible: ERROR_code: Connection error. Any Ideas?

Engelbert Rodríguez


What do you mean with "fully functional" with your router? Do you have good communications between the PLC and the programming TwinCat PC? I haven´t worked with the email function but I´ve found that Beckhoff its very sensitive with ethernet communications and the TCP/IP configuration (same network, sub-net, IP range, etc).

Engelbert Rodríguez
Yeah, are you pointed (sSmtpServer) to a *valid* SMTP server? That's harder that it sounds.

The error code (nErrId) will help a lot. It will be more specfic than just 'Connection error'.

You can find documentation of this block on Beckhoff's website with a table of Error codes and descriptions.

If you have any more specific questions you can email me direct.

[email protected]

Automation Linse

Who runs your SMTP server? Someone like AOL or an ISP? Be aware the SMTP is a deceptively trivial protocol, yet very few SMTP servers allow all "legal" command combinations - especially in this day of SPAM. They go overboard to attempt to block bulk emailers. Most will require one of many possible authentication methods (ie: "login"), and many will not accept email which lacks certain "optional" fields. Some expect blank lines between header & body - which is not required by the RFC.

The SMTP protocol is simple ASCII commands, so run Ethereal or some other sniffer to watch the full conversation. You will see exactly what the SMTP server returns as the error - which will include both a number code and nice user-readable string.

I have written embedded systems that send email - and it is quite a struggle to create one that works with all commercial SMTP servers.

best regards
- LynnL, www.digi.com

Peter Caelen

Hello Engelbert,

What do you mean with very sensitive with ethernet communications and the TCP/IP configuration (same network, sub-net, IP range, etc)?

Peter Caelen

Engelbert Rodríguez

Hello Peter,

I mean that, according to my experience with beckoff some times for unknow reasons suddenly it loss the communications and you can not see the link, and normally for me has been a nightmare the first communication with a new processor. It´is not that easy as plug and communicate.


My experience has been the opposite. Any loss of communications we have had have been network related. There are settings in the BC that make it less sensitive to delayed messages. The BC is designed for industrial control applications and has a default internal watchdog of 1000ms - it is automatically assumed that if an EtherNet frame cannot transmit in one second something is wrong. This can be adjusted and even turned off. I suspect that is the root cause of your problem.

We, the community, are using Ethernet as a fieldbus so it has to be treated as such.

Also make sure that the BC has the same subnet address (this is for security reasons) as the PC you are communicating, or use DHCP.

For example if the BC IP settings are:

IP Address:
Subnet Mask:

Make sure your PC has the settings:

IP Address: 172.16.17.any other unique number
Subnet Mask:

And you will never have any problems.

Robert Trask, PE
Los Angeles, CA

Engelbert Rodríguez

Thank you for your suggestions, I'll try that the next time. I don't know if is network related, but I've had a lot of problems with the communications...


Peter Caelen


We have indeed the problem of communication loss. It’s always a short time (seconds). We have (try) to connect 64 beckhoff’s on one network. 6 of then, seems random, have the problem. The rest is working well. We will try your advice.

Peter Caelen
The Netherlands