I want to make an NTP server application. In this application I am using a 5APC3100_KBU3_000 model controller and my controller will be an NTP server. Another computer will be connected to my controller via ethernet as NTP client. However, in the function block I found with the help of B&R help, although there are helpful contents about starting the NTP server, I could not find where to write this time information or what is the ip address of the NTP Server I installed. I started the NTP server from the controller configuration, but I could not see any sign that the server was running. I am sharing the function structure I got help from here as .pdf. I would be very grateful if anyone has made such an application before or if anyone can help.
In the CfgGetNtpsData function, I can see that the server is running and I am sharing the screenshot with you. I also set the IP address of the controller in the ETH configuration. However, the NTP Client application that I use on the other computer wants it on a port. In this case, how can I find out the port number?
However, I am not sure whether ntpclient should connect to the IP address of the controller. For example, I normally connect to the controller from 192.168.1.1 to transfer the project. In this case, should I set the server IP to which ntpclient should also connect? Also, which function can I use to find out the time information that the NTP Server transfers to the clients?
The port used is the standard SNTP port is 123, and that is the port used by the B&R PLC SNTP server. You can find a full map of ports used by B&R PLCs in the Automation Studio help. Ethernet Ports - B&R Online Help (br-automation.com)
The NTP client device needs to know the IP address (or host name) of the B&R controller that is reachable from the NTP client. If your NTP client device connects to the B&R controller on the same Ethernet Interface as your laptop for AS, then you would provide the same IP address to the NTP client for time synchronization.
The SNTPS server largely operates in the background (or ‘shadows’ if it sounds cooler). The time that is transferred to the NTP client will be the current time on the B&R controller. To set the current time with Automation Studio, you can use the top menu item Online > Info… while connected to the B&R controller. On the Time and Date tab, you can set the PLC time.
In fact, we have successfully installed the NTP Server, but the application we used as ntp client required a port and ip address. I entered the ip address in the ETH1 configuration in the ip address and 123 in the port as you said. In this way, I was able to make a successful connection with the ntp client. However, I could not find how to pull the time produced by the NTP Server as a variable because I am writing my project in C. So I used the function structure of the type you will see below.