UDP 데이터 전송시 문의 사항(타임 아웃 관련)

  1. 소스 수정 을 하여 UDP Send 인 sendto 함수 내를 수정 하였습니다. ARP 확인 및 전송 확인을 하는
    sendto 함수의 제일 마지막 while 부분을 삭제를 하고 main 에서 계속

uint8_t upd_send_check()
{
uint32_t tmp = getSn_IR(sn);
if(tmp & Sn_IR_SENDOK)
{
setSn_IR(sn, Sn_IR_SENDOK);
return SENDOK;
}
else if(tmp & Sn_IR_TIMEOUT)
{
setSn_IR(sn, Sn_IR_TIMEOUT);
return SOCKERR_TIMEOUT;
}
return SENDING;
}
을 감시 하게 소스를 수정 하였습니다. - 이부분을 함수로 만들어 계속 확인 하였습니다.

main()
{
uint upd_send_ok = 0
while(1)
{
if(upd_send_ok == 0)
{
udp 서버(0번소켓);
udp 데이터 확인(0번소켓);
udp 데이터 전송(0번소켓); - upd_send_ok = 1;
}
udp 서버(1번소켓);
if(upd_send_check(0번소켓) != SENDING)
{
upd_send_ok = 1;
}
}
}

  1. 결과
    있지 않는 IP에 데이터를 전송을 하면 약 1.6초 이후에 SOCKERR_TIMEOUT 를 확인 할수 있습니다.
    그런데 문제는 약 30% 정도는 타임 아웃이 아닌 Send OK를 반환 합니다.
    OK를 반환 할때도 타임 아웃과 시간은 동일 합니다.
    즉 Send 할때도 다른 소켓을 관찰 및 사용을 할수 있게 레지스트를 읽어 확인을 하려고 수정을 한것인데 레지스트로 확인을 하였는데 OK가 확인이 되는 이유를 잘 모르겠습니다.

질문 - 데이터 전송중 다른일(다른 소켓 관리 전송 및 데이터 받기)을 하면서 전송 완료 레지스트를 확인 하면 문제가 되는 건가요??

Please format your code per template to look like code.
Did not get first point. Is it a question, or statement?
Second point: UDP is connectionless protocol, when you send datagram, in my opinion, you can only get send error or send ok. The only location you may get this error in UDP mode is here. In my opinion, this may happen if you have problem with physical connection (cable is not connected to the chip, or there’s some very low-level error there).
The last question - yes, you can operate other sockets while the socket is being waited for. In the abovementioned link at line 401 which is

while(1)

you can redesign it to exit here and perform something else on other sockets, but when you return to this socket you must ensure command has completed and you evaluated the result before doing anything else on this particular socket.

1 Like