Hello,
on a CR1000, we're creating a program that receives a UDP packet from a PC and responds UDP packets back to the PC.
After some unresolved difficulties with a version that uses UDPOpen to open the socket, Serialin to receive, and Serialout to send (see post https://www.campbellsci.eu/forum?forum=1&l=thread&tid=17627), we decided to test using the UDPDataGram instruction.
The result is that all messages are correctly received by the PC, but no messages are sent in response, despite the program clearly passing the send instruction (sending an "OK"). I assume we haven't understood the meaning of the UDPDataGram function parameters.
The tests were performed with a CR1000 with the operating system updated to the latest version and with both the NL201 and NL121 devices (in separate tests, obviously).
We captured the packets with Wireshark on the PC and with the CR1000's internal function on the CR1000 itself. The traced packets show no trace of sending, only reception.
Any suggestions?
I'll post here the program used for testing:
Public RX As String * 63 Public TX As String * 63 = "OK" Public Sock As Long Public nBytesRX As Long Public nBytesTX As Long Public ipInfoVar As String BeginProg Sock = 0 Scan (5,Sec,0,0) RX = "" TX = "" nBytesRX = UDPDataGram ("", 5683, 0, 0, RX, 1000, Sock,0) ipInfoVar = IPInfo(Sock,0) If nBytesRX > 0 Then TX = "OK" nBytesTX = UDPDataGram ("", 5683, TX, len(TX), 0, 0, Sock, 0) EndIf NextScan EndProg