We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Only one question please What is the definition of mem_test() function in TCPnet manual
void send_data (void) { static const U8 rem_IP[4] = {192,168,0,100}; U8 *sendbuf; if (wait_ack == __TRUE) { return; } if (mem_test (localm[NETIF_ETH].IpAdr, 0, 4) == __TRUE) { /* IP address not yet assigned by DHCP. */ return; } if (bindex < 128) { sendbuf = udp_get_buf (512); for (i = 0; i < 512; i += 2) { sendbuf[i] = bcount >> 8; sendbuf[i+1] = bcount & 0xFF; } udp_send (udp_soc, rem_IP, 1000, sendbuf, 512); } }
Is it a member of stdio.h library? I can not address it anywhere even on google... Thanks kom
It's defined in net_config.h as:
extern BOOL mem_test (void *sp, U8 val, int len);
Looking at the context of where you've taken it from, I would suspect that it is checking a block to see if it all contains a specific value; i.e., all IP address would be zero until DHCP had aquired something useful.
It appears to be undocumented.
A site search for it finds only the above code example at www.keil.com/.../rlarm_tn_using_udp_dhcpen.htm
:-(
Yes ...
<rant> And because Keil don't supply the source code to their TCP library (at least, not at a reasonable cost) you can't easily determine what it does. </rant>