uip协议栈,STC12LE58AD单片机。问题是得不到网页数据,10延迟后退出,发送无数据。
调试httpd部分串口输出如下:
ip: version4 header.
ip: POSSIBLE TCP RECEIVED.
tcp: checksum correct.
ip: version4 header.
ip: POSSIBLE TCP RECEIVED.
tcp: checksum correct.
tcp: goto found.
TCP: found 2.
TCP: found 3.
httpd_appcallTCP
HTTP_NOGET
TCP: found SYN_RCVD.
ip: version4 header.
ip: POSSIBLE TCP RECEIVED.
tcp: bad checksum.
ip: version4 header.
ip: POSSIBLE TCP RECEIVED.
tcp: checksum correct.
tcp: goto found.
TCP: found 1.
httpd_appcall
httpd_appcall
httpd_appcall
httpd_appcall
httpd_appcall
httpd_appcall
httpd_appcall
httpd_appcall
httpd_appcall
httpd_appcall
httpd_appcall
TCP: sending nodata
UIP_ABORT
wireshark抓捕如下:
主程序如下:
void main(void)
{
u8_t arptimer;
u8_t i;
InitHardware();
uip_init();
httpd_init();
//etherdev_init();
//enc28j60Init(mymac);
uip_arp_init();
arptimer = 0;
while(1)
{
WDT_CONTR=0x3C;//看门狗
timer0();
//----------------------------------------//定时更新ARP
if(double_second)
{
double_second = 0;
//SBUF=0XAA;
for(i = 0; i < UIP_CONNS; i++)
{
uip_periodic(i);
//If the above function invocation resulted in data that
//should be sent out on the network, the global variable
//uip_len is set to a value > 0.
if(uip_len > 0)
{
uip_arp_out();
enc28j60PacketSend(uip_len,uip_buf);
}
}
}
// uip_arp_timer();
//-----------------------------------------------------------------//检测数据接收
//uip_len = etherdev_read();
uip_len=enc28j60PacketReceive(UIP_BUFSIZE,uip_buf);
if(uip_len == 0)
continue;
if(ETHBUF->type == htons(UIP_ETHTYPE_IP))//0x0800//IP协议族
{
if(BUF->proto==UIP_PROTO_TCP)//tcp
{
uip_process(UIP_DATA);
if(uip_len > 0)
enc28j60PacketSend(uip_len,uip_buf);//0x06
continue;
}
if(BUF->proto==UIP_PROTO_ICMP)//icmp//0x01
{
uip_arp_ipin();
uip_input();
if(uip_len > 0)
{
uip_arp_out();
//etherdev_send();
enc28j60PacketSend(uip_len,uip_buf);
continue;
}
}
if(BUF->proto==UIP_PROTO_UDP)//udp//17
{
continue;
}
}
if(ETHBUF->type == htons(UIP_ETHTYPE_ARP))//0x0806
{
//UART1_PutStr(uip_buf,42);
uip_arp_arpin();
if(uip_len > 0)
{
//etherdev_send();
enc28j60PacketSend(uip_len,uip_buf);
continue;
}
}
/*
if(BUF->proto==UIP_PROTO_TCP)
{
uip_process(UIP_DATA);
if(uip_len > 0)
enc28j60PacketSend(uip_len,uip_buf);
continue;
}
*/
}//end while
return;
}
<A class=ednchina_image title=点击查看 href="http://bbs.ednchina.com/downloadAttachment!attachment.jspa?attachmentId=10141652" ><img style="CURSOR: hand" src="http://bbs.ednchina.com/downloadAttachment!attachment.jspa?attachmentId=10141652" alt="" />
ping 都没问题
用wireshark查看,碎片传输的时候数据都已经填充进包了,但没有得到客户机的承认ACK。
用户1270731 2010-12-10 20:06
用户208467 2009-1-12 07:30