Hello
I have some problems to get my test code to work to receive UDP packages.
I have a broadcaster that sends UDP packages on 192.168.15.X
But I can't get the code to receive the packages.
When I use a test server on my pc like packet senderΒ and I send UDP directly to my plc then I receive the packages.
But also here when I broadcast from the pc and send to 255.255.255.255 I don't the packages
My controller has the IP address 192.168.15.67
Hope someone can help me out what is wront
nbs.UDP_Receive block works only once after xExecute triggered.
So, right after "Receive.xReady = TRUE", you should set "Receive(xEnable := FALSE)" and then "Receive(xEnable := TRUE)" to get next package.
Also I see in the IF statement "Receive.szSize = SIZEOF(udpData)" - maybe you should set "Receive.szSize = Receive.udiCount" or "Receive.udiCount = SIZEOF(udpData)" instead, if you checking received package size
Last edit: asivakov 2021-03-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I have some problems to get my test code to work to receive UDP packages.
I have a broadcaster that sends UDP packages on 192.168.15.X
But I can't get the code to receive the packages.
When I use a test server on my pc like packet senderΒ and I send UDP directly to my plc then I receive the packages.
But also here when I broadcast from the pc and send to 255.255.255.255 I don't the packages
My controller has the IP address 192.168.15.67
Hope someone can help me out what is wront
sure it should be 255.255.255.255 and not 255.255.255.0
With 255.255.255.255 you have limited broadcast
nbs.UDP_Receive block works only once after xExecute triggered.
So, right after "Receive.xReady = TRUE", you should set "Receive(xEnable := FALSE)" and then "Receive(xEnable := TRUE)" to get next package.
Also I see in the IF statement "Receive.szSize = SIZEOF(udpData)" - maybe you should set "Receive.szSize = Receive.udiCount" or "Receive.udiCount = SIZEOF(udpData)" instead, if you checking received package size
Last edit: asivakov 2021-03-03