📄 testping.c
字号:
#include "debug.h"
#include "true_false.h"
#include "stdlib.h"
#include "typedef.h"
#include "mem_man.h"
#include "rtl8019.h"
#include "netif.h"
#include "etherif.h"
#include "ip.h"
#include "arp.h"
#include "utilities.h"
#include "tcp.h"
#include "icmp.h"
u8_t myip[20]={"192.168.2.13"},hisip[20]={"192.168.2.12"};
/*这份代码经源码格式软件格式化过
yang_hx@neusoft.com */
void do_ping(u8_t*my_ip,u8_t*his_ip,u32_t lenth,u32_t count)
{
u8_t tmr ;
//testtmr();
for(;count>0;--count)
{
//Uart_Printf( "PINGOut(iptoul(ips),iptoul(ipd),1000);" ) ;
PINGOut(iptoul(my_ip),iptoul(his_ip),lenth);
for(tmr=0;tmr<100;tmr++)
{
wait_ms(10);
if(get_state()==PING_OK)
break ;
}
if(get_state()==PING_OK)
{
if(tmr==0)
{
Uart_Printf("\nReply from %s: byte=%d time<%dms",hisip,lenth,10);
}
else
{
Uart_Printf("\nReply from %s: byte=%d time=%dms",hisip,lenth,tmr*10);
}
}
else
{
Uart_Printf("\nRequst timed out.");
}
}
}
void ping(void)
{
u32_t cnt,len ;
while(1)
{
Uart_Printf("\npls input the IP address you want to ping\n==>");
Uart_GetString(hisip);
if(iptoul(hisip)==0)break ;
Uart_Printf("pls input the times you want to ping\n==>");
cnt=Uart_GetIntNum();
Uart_Printf("pls input the lenth of the package\n==>");
len=Uart_GetIntNum();
do_ping(myip,hisip,len,cnt);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -