Hi All
Here is some more information about the function fnSendPing():
extern int fnSendPing(unsigned char *ping_address, unsigned char ucTTL, UTASK_TASK OwnerTask, USOCKET Socket);
Example of use:
if (NO_ARP_ENTRY == fnSendPing(ping_address, MAX_TTL, OWN_TASK, dummy_socket)) {
fnDebugMsg("ARP resolution started\n\r");
}
ping_address is a pointer to the destination IP address, eg:
unsigned char ping_address[IPV4_LENGTH] = {192, 168, 0, 23};
MAX_TTL sets the Time To Live field of the IP frame to the maximum value of 128 (defined in tcpip.h), which is the maximum hops that are allowed to reach the destination address.
OWN_TASK enters the owner so that either ARP or ICMP knows which task to inform when there are events to be handled. As in the case of fnSendPing returning NO_ARP_ENTRY, ARP will inform the task then when either the address has been resolved or if it declares that the address is not resolvable.
dummy-Socket is a fictive socket reference - ICMP doesn't use sockets - so that each pin result can be differentiated from others which may be in process at the same time:
If the above example were called, say, 5 times as fast as possible 5 different IP addresses could be pinged. Each ping call uses a different 'fictive' socket number (eg, 1,2,3,4,5) as a reference.
When an ARP reolution event of the ping test result is ready, the task is woken with an event (eg. ARP_RESOLUTION_SUCCESS or PING_RESULT - the socket parameter accompanies this event so that the software can known wich of the actual ping tests, and which IP address is relevent.
Thus it is quite easily possible (as shown in the demo) to ping several addresses at the same time and individually handle each result.
Regards
Mark