extern int fnUDPListner(USOCKET SocketNr, unsigned char ucEvent, unsigned char *ucIP, unsigned short usPortNr, unsigned char *data, unsigned short usLength)
{
    switch (ucEvent) {
    case UDP_EVENT_RXDATA:
		{
			// TI stellaris Discover code
			// An array that contains the device locator response data.  The format of the
			// data is as follows:
			//
			//     Byte        Description
			//     --------    ------------------------
			//      0          TAG_STATUS
			//      1          packet length
			//      2          CMD_DISCOVER_TARGET
			//      3          board type
			//      4          board ID
			//      5..8       client IP address
			//      9..14      MAC address
			//     15..18      firmware version
			//     19..82      application title
			//     83          checksum
			//
			#define TAG_CMD                 0xff
			#define TAG_STATUS              0xfe
			#define CMD_DISCOVER_TARGET     0x02
			
			unsigned char g_pucLocatorData[84];
			unsigned long ulIdx;
			
			// Validate the contents of the datagram.
			if((usLength != 4) || (data[0] != TAG_CMD) || (data[1] != 4) || (data[2] != CMD_DISCOVER_TARGET) || (data[3] != ((0 - TAG_CMD - 4 - CMD_DISCOVER_TARGET) & 0xff)))
			{
				break;
			}
			// Clear out the response data.
			for(ulIdx = 0; ulIdx < 84; ulIdx++) 
			{
				g_pucLocatorData[ulIdx] = 0;
			}
			// Fill in the header for the response data.
			g_pucLocatorData[0] = TAG_STATUS;
			g_pucLocatorData[1] = sizeof(g_pucLocatorData);
			g_pucLocatorData[2] = CMD_DISCOVER_TARGET;
			// Save the board type in the response data.
			g_pucLocatorData[3] = 11;
			// Save the board ID in the response data.
			g_pucLocatorData[4] = 22;
			// Save the client IP address in the response data.
			g_pucLocatorData[5] = network.ucOurIP[0];
			g_pucLocatorData[6] = network.ucOurIP[1];
			g_pucLocatorData[7] = network.ucOurIP[2];
			g_pucLocatorData[8] = network.ucOurIP[3];
			// Save the MAC address.
			g_pucLocatorData[9] = network.ucOurMAC[0];
			g_pucLocatorData[10] = network.ucOurMAC[1];
			g_pucLocatorData[11] = network.ucOurMAC[2];
			g_pucLocatorData[12] = network.ucOurMAC[3];
			g_pucLocatorData[13] = network.ucOurMAC[4];
			g_pucLocatorData[14] = network.ucOurMAC[5];
			// Save the firmware version number in the response data.
			g_pucLocatorData[15] = 1;
			g_pucLocatorData[16] = 2;
			g_pucLocatorData[17] = 3;
			g_pucLocatorData[18] = 4;
			{
				unsigned long ulCount;
				const unsigned char Title[8] = {"uTasker"};
				char *pcAppTitle;

				pcAppTitle = Title;
				// Copy the application title string into the response data.
				for(ulCount = 0; (ulCount < 64) && *pcAppTitle; ulCount++)
				{
					g_pucLocatorData[ulCount + 19] = *pcAppTitle++;
				}
			}
			// Calcuate and fill in the checksum on the response packet.
			for(ulIdx = 0, g_pucLocatorData[sizeof(g_pucLocatorData) - 1] = 0; ulIdx < (sizeof(g_pucLocatorData) - 1); ulIdx++)
			{
				g_pucLocatorData[sizeof(g_pucLocatorData) - 1] -= g_pucLocatorData[ulIdx];
			}
            uMemcpy(&ptrUDP_Frame->ucUDP_Message, g_pucLocatorData, sizeof(g_pucLocatorData));     // send the received UDP frame back
            fnSendUDP(MyUDP_Socket, ucIP, usPortNr, (unsigned char*)&ptrUDP_Frame->tUDP_Header, sizeof(g_pucLocatorData), OWN_TASK);
		}
		break;

    case UDP_EVENT_PORT_UNREACHABLE:                                     // we have received information that this port is not available at the destination so quit
        break;
    }
    return 0;
}