Home AMX Technical Discussion

Feedback with UDP/IP

Hello!

Sometimes I get a response from the equipment on UDP / IP, sometimes I do not get a response. When I test through the Hercules program, the answer always comes.
Help me please.

case 'STOP_4':
{
ip_server_open(16, 5000, IP_UDP)
ip_client_open(12,BsHO4_IP,5000,3)
wait(5){
send_string dv_Bs_Delivery1014_UDP, "'StopCL'"
wait(5){
send_string 0,"'Reply BS4:',BufferBs2,13,10"
if (find_string(BufferBs2, 'Stop_Ok',1)=0){
wait(5){
send_string dv_Bs_Delivery1014_UDP, "'StopCL'"
wait(5){
send_string 0,"'Reply BS4:',BufferBs2,13,10"
if (find_string(BufferBs2, 'Stop_Ok',1)=0){
wait(5){
send_string dv_Bs_Delivery1014_UDP, "'StopCL'"
wait(5){
send_string 0,"'Reply BS4:',BufferBs2,13,10"
if (find_string(BufferBs2, 'Stop_Ok',1)=0){
send_command 0:1:2, "'LOG, 2, Brightsign_Delivery4_1014 StopCL error'"
}
}
}
}
}
}
}
ip_client_close(16)
ip_server_close(12)
clear_buffer BufferBs2
}
}
}

Comments

  • sling100sling100 Junior Member Posts: 104

    Hey TimurG

    I've had exactly the same issue with UDP before. Sometimes it responds, sometimes not. Sometimes if you open a second client on the same port it works by replying to the second client instead of the first.

    Anyway the best way I've found is to use a single client (no server required) using IP_UDP_2WAY rather than IP_UDP and to then bind the AMX port to the same port number.

    Like this:
    IP_BOUND_CLIENT_OPEN(dvUDP.PORT,5010,'192.168.1.1',5010,IP_UDP_2WAY)

    The return strings will then appear in the dvUDP DATA_EVENT as per a TCP client.

    Hope it helps!

    Simon

  • TimurGTimurG Posts: 4

    I changed it and it worked:

    • the server is always open ip_server_open(16, 5000, IP_UDP), and I put it in the DEFINE_START
    • feedback comes on the
      DATA_EVENT [0:16:1]
      {
      string:
      {
      send_string 0,"'Reply BS4:',BufferBs2,13,10"
      if (find_string(BufferBs2, 'Stop_Ok',1)=0){
      wait(5){
      send_string dv_Bs_Delivery1014_UDP, "'StopCL'"
      wait(5){
      send_string 0,"'Reply BS4:',BufferBs2,13,10"
      if (find_string(BufferBs2, 'Stop_Ok',1)=0){
      wait(5){
      send_string dv_Bs_Delivery1014_UDP, "'StopCL'"
      wait(5){
      send_string 0,"'Reply BS4:',BufferBs2,13,10"
      if (find_string(BufferBs2, 'Stop_Ok',1)=0){
      send_command 0:1:2, "'LOG, 2, Brightsign_Delivery4_1014 StopCL error'"
      }
      }
      }
      }
      }
      }
      }
      clear_buffer BufferBs2
      }
      }
Sign In or Register to comment.