[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Raw-api UDP example :Can not receive UDP-messages
From: |
the_gadfly |
Subject: |
Re: [lwip-users] Raw-api UDP example :Can not receive UDP-messages |
Date: |
Sun, 28 Jun 2009 19:55:35 -0700 (PDT) |
The code below are Ethereal's display.
.
.
2930 3.778501 Altera_ff:48:08 ff:ff:ff:ff:ff:ff ARP Who has 10.1.1.52? Tell
10.1.1.51
2931 3.778536 Altera_ff:48:08 ff:ff:ff:ff:ff:ff ARP Who has 10.1.1.52? Tell
10.1.1.51
.
.
.
2935 3.790042 WUDI Altera_ff:48:08 ARP 10.1.1.52 is at
00:0c:76:8a:93:e6
.
.
.
you could see that the pc answered the board's ARP,but it did nothing
cheers
the_gadfly
the_gadfly wrote:
>
> hi :
> I am a new guy to lwip ,and when i use udp to my design .i hit a big
> broblem.After seaching a long time,it is still here .I can't receive any
> udp message at all,though there are ARPs between PC and NIOS .here is my
> code ,Could anyone tell me what's wrong?
>
> I am going crazy overhere....
> cheers
> the_gadfly
> -------------------------------------------------
> void httpd_init(void)
> { char Test[]="hello world !";
> struct udp_pcb *pcb;
> struct ip_addr ipaddr;
> struct pbuf *p;
> err_t err;
>
> IP4_ADDR(&ipaddr,10,1,1,52);
>
> p = pbuf_alloc(PBUF_RAW,15,PBUF_RAM);
> p->payload=(void *)Test;
> p->len=p->tot_len=15;
>
> pcb = udp_new();
> err=udp_bind(pcb, IP_ADDR_ANY, 30);
> printf("err= %s",err);
> err=udp_connect(pcb,&ipaddr,30);
> printf("err= %s",err);
>
> err=udp_send(pcb,p);
> printf("err= %s",err);
> pbuf_free(p);
> udp_remove( pcb );
> }
>
> int main(void)
> {
> //0.6.4 struct netif *netif;
> struct netif netif;
> struct ip_addr ipaddr, netmask, gw;
> unsigned int now, lasttime;
> int i;
> #if IP_REASSEMBLY
> int j;
> #endif
>
> alt_avalon_lan91c111_if* dev_list_ptr =
> (alt_avalon_lan91c111_if*)alt_ethernet_device_list.next;
>
> printf("Example web server using Light-weight IP (LWIP)\n");
> printf("and simple RAM-based file system.\n\n");
>
> /*
> * Initialize lwip
> */
> lwip_init();
>
> printf ("Setting IP address to: %d.%d.%d.%d\n", IPADDR0, IPADDR1,
> IPADDR2, IPADDR3);
> printf ("Setting netmask to: %d.%d.%d.%d\n", NETMASK0, NETMASK1,
> NETMASK2, NETMASK3);
> printf ("Setting gateway address to: %d.%d.%d.%d\n", GWADDR0, GWADDR1,
> GWADDR2, GWADDR3);
> IP4_ADDR(&ipaddr, IPADDR0, IPADDR1, IPADDR2, IPADDR3);
> IP4_ADDR(&netmask, NETMASK0, NETMASK1, NETMASK2, NETMASK3);
> IP4_ADDR(&gw, GWADDR0, GWADDR1, GWADDR2, GWADDR3);
>
> //0.6.4 netif = netif_add(&ipaddr, &netmask, &gw,
> netif_add(&netif, &ipaddr, &netmask, &gw,
> (void*)dev_list_ptr,
> lan91c111if_init,
> ip_input);
> //0.6.4 netif_set_default(&netif);
> netif_set_default(&netif);
>
> /*
> * Initialize application(s)
> */
> httpd_init();
> //udp_echo_init();
>
>
> /* main loop to service the Ethernet device and expire TCP timers
> */
> lasttime = get_milliseconds();
>
> i=0;
> #if IP_REASSEMBLY
> j=0;
> #endif
>
> while(1)
> {
> //0.6.4 lan91c111if_service(netif);
> lan91c111if_service(&netif);
>
> now = get_milliseconds();
> if (now - lasttime > TCP_TMR_INTERVAL) {
> lasttime = now;
> tcp_tmr();
> if (++i==50) {
> //etharp_tmr();
> i=0;
> }
> }
>
> #if IP_REASSEMBLY
> if (++j==1000) {
> ip_reass_timer();
> j=0;
> }
> #endif
>
> }
> }
> ------------------------------------
>
>
--
View this message in context:
http://www.nabble.com/Raw-api--UDP-example-%3ACan-not-receive-UDP-messages-tp24214474p24247745.html
Sent from the lwip-users mailing list archive at Nabble.com.