mainSavannah Administration - Support: sr #106914, what's wrong with my lwip-raw api...

 
 

sr #106914: what's wrong with my lwip-raw api udp_send design?

Submitter:  wudi <the_gadfly>
Submitted:  Thu 25 Jun 2009 12:47:25 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Invalid
Privacy:  Public Assigned to:  zeus
Operating System:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 25 Jun 2009 01:59:27 PM UTC, comment #1: 

Hi,

This support tracker it's for the Savannah site itself not for the projects hosted here.
If you want to get help with the lwip project you may want to review this link: https://savannah.nongnu.org/projects/lwip

Regards,

Jonathan Gonzalez V. <zeus>
Thu 25 Jun 2009 12:47:25 PM UTC, original submission:  

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 cant receive any udp message at all ,i hope you could help me
here is my code ,can you see some incorrect things?
thank you
the_gadfly
---------------------------
#include "system.h"
#include "lwip/debug.h"
#include "lwip/stats.h"
#include "arch/init.h"
#include "lwip/ip_addr.h"
#include "lwip/tcpip.h"
#include "lwip/netif.h"
#include "netif/lan91c111if.h"
#include "lwip/udp.h"
#include
#include "httpd.h"


#include "sys/alt_alarm.h"
#define get_milliseconds() alt_nticks()
int n;
/* ---------- IP oriented addresses for ethernet adapter ---------- */
#define IPADDR0 10
#define IPADDR1 1
#define IPADDR2 1
#define IPADDR3 51

#define NETMASK0 255
#define NETMASK1 255
#define NETMASK2 255
#define NETMASK3 0

#define GWADDR0 10
#define GWADDR1 1
#define GWADDR2 1
#define GWADDR3 2
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

}
}
------------------------------------


wudi <the_gadfly>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by zeus (Posted a comment)
  • -email is unavailable- added by the_gadfly (Submitted the item)
  • -email is unavailable- added by the_gadfly
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-06-25 zeus StatusNone Invalid
        Assigned toNone zeus
        Open/ClosedOpen Closed
    2009-06-25 the_gadfly Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code