lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] contrib/apps/chargen/chargen.c doesn't receive any packet


From: stanliao
Subject: [lwip-users] contrib/apps/chargen/chargen.c doesn't receive any packet
Date: Wed, 30 Jul 2008 13:17:53 +0800

Dear All,

 

I downloaded LWIP and added some port code to adapt LWIP to ucOS/II. Currently, the overall program can send UDP to network-world; but when I use “chargen” as the test program, chargen_thread() hangs at i = select(maxfdp1, &readset, &writeset, 0, 0); statement in “chargen.c”. Please refer to the following program for the LWIP initialization. I traced into “raw.c” raw_input() function and found that the global variable raw_pcbs is 0 (NULL) while receiving a packet. Then, I traced whether any pcb is created! I found that chargen_thread() calls socket(); socket() calls netconn_new_with_proto_and_callback(); the comment for netconn_new_with_proto_and_callback() says that the corresponding pcb is also created, however, do_newconn() is never called to create pcb. Is there anything (configuration or initialization) I missed? Thank you very much.

 

Best Regards,

Stan Liao

 

--- (initialization)

         /* initialize lwip */

         tcpip_init(NULL,NULL);

 

         /* initialize net interface (TODO: replace this hard-copy address)*/

         IP4_ADDR(&eth0_ipaddr,  172,  16, 101, 3);

         IP4_ADDR(&eth0_netmask, 255, 255, 255, 0);

         IP4_ADDR(&eth0_gw,      172,  16, 101, 254);

#if LWIP_ARP

         netif_add(&eth0_netif, &eth0_ipaddr, &eth0_netmask, &eth0_gw, NULL, ethernetif_init, ethernet_input);

#else

    netif_add(&eth0_netif, &eth0_ipaddr, &eth0_netmask, &eth0_gw, NULL, ethernetif_init, ip_input);

#endif

         netif_set_default(&eth0_netif);

         netif_set_up(&eth0_netif);

 

         OSTimeDly(OS_TICKS_PER_SEC);

 

         /* initialize applications */

#ifdef TE_TEST_CHARGEN

         chargen_init();

#endif

//#ifdef TE_TEST_HTTPSERVER_RAW

#if 0

         httpd_init();

#endif

 

#if 0

{

         struct udp_pcb *UDP_PCB;

         err_t result;

         struct ip_addr remote_ipaddr;

         struct pbuf *buffer, *p;

         int idx;

         char sendString[32];

 

         IP4_ADDR(&remote_ipaddr, 172, 16, 101, 134);

 

         UDP_PCB = udp_new();

         if (!UDP_PCB)

                  return;

 

         result = udp_bind(UDP_PCB, &eth0_ipaddr, 333);

         if (result != ERR_OK)

         {

                  udp_remove(UDP_PCB);

                  return;

         }

 

         //udp_recv(UDP_PCB, UDP_Receiver, NULL);

         udp_connect(UDP_PCB, &remote_ipaddr, 333);

 

         buffer = pbuf_alloc(PBUF_RAW, 512, PBUF_POOL);

         for (p = buffer; p != NULL; p = p->next)

         {

                  for (idx = 0; idx < p->len; ++idx)

                          ((char *) (p->payload))[idx] = ' ';

         }

 

         for (idx = 0; ; ++idx)

         {

                  udp_send(UDP_PCB, buffer);

                  if (idx % 100 == 0)

                          sysInfo("send packet_%d\r\n", idx);

                  OSTimeDly(OS_TICKS_PER_SEC/30);

         }

}

#endif

---

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]