61
NXPTM M522XX, KINETIS and i.MX RT / Re: 1 UDP socket for server and client?
« on: June 29, 2022, 12:50:38 AM »
Neil
If you send a UDP packet to an IP address whose MAC is not known it will cause ARP resolution to be started (and not the UDP frame being sent).
ARP informs the owner task, which can then resend the UDP frame when the MAC address is known:
case TASK_ARP:
fnRead(PortIDInternal, ucInputMessage, ucInputMessage[MSG_CONTENT_LENGTH]); // read the message content
switch (ucInputMessage[0]) { // ARP sends us either ARP resolution success or failed
case ARP_RESOLUTION_SUCCESS: // IP address has been resolved (repeat UDP frame).
fnSendUDP(MyUDP_Socket, ucUDP_IP_Address, MY_UDP_PORT, (unsigned char*)&ptrUDP_Frame->tUDP_Header, UDP_BUFFER_SIZE, OWN_TASK);
break;
case ARP_RESOLUTION_FAILED: // IP address could not be resolved...
break;
}
break;
See also the UDP thread at https://www.utasker.com/forum/index.php?topic=41.0 which explains it in detail.
Regards
Mark
If you send a UDP packet to an IP address whose MAC is not known it will cause ARP resolution to be started (and not the UDP frame being sent).
ARP informs the owner task, which can then resend the UDP frame when the MAC address is known:
case TASK_ARP:
fnRead(PortIDInternal, ucInputMessage, ucInputMessage[MSG_CONTENT_LENGTH]); // read the message content
switch (ucInputMessage[0]) { // ARP sends us either ARP resolution success or failed
case ARP_RESOLUTION_SUCCESS: // IP address has been resolved (repeat UDP frame).
fnSendUDP(MyUDP_Socket, ucUDP_IP_Address, MY_UDP_PORT, (unsigned char*)&ptrUDP_Frame->tUDP_Header, UDP_BUFFER_SIZE, OWN_TASK);
break;
case ARP_RESOLUTION_FAILED: // IP address could not be resolved...
break;
}
break;
See also the UDP thread at https://www.utasker.com/forum/index.php?topic=41.0 which explains it in detail.
Regards
Mark