lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Problem in UDP send


From: 'ZENG Ming'
Subject: [lwip-users] Problem in UDP send
Date: Sun, 6 Nov 2005 16:28:09 +0100

Hi all,

I'm trying to test throughput with UDP protocol.

And got something wrong with RAW API,  while the Sequence API
(netconn_*)worked fine.

I'm using current CVS version of lwIP, and the problem always existed no
matter enable ARP_QUEUEING or not.

With following function, I only got 2000 ARP requests ( with 2000 ARP
replies ), but no UDP packet was sent out.

//------------------------------------------
void udp_test_Raw(void)
{
  struct ip_addr ipaddr;
  struct udp_pcb *pcb;
  struct pbuf *pb;
  INT16U i;
  char str[1400]="1234567890";
  IP4_ADDR(&ipaddr, 192,168,11,120);
 
  pcb = udp_new();
  udp_connect(pcb, &ipaddr, 12024);

  pb = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_REF);
  pb->payload = str;
  pb->len = pb->tot_len = 1400; 

  for (i=0;i<2000;i++) udp_send(pcb, pb);
 
  pbuf_free(pb);
  udp_remove(pcb);
}
//---------------------------------

I've also tried to use sequence API as following, and it worked
properly.

One ARP was sent first, and then 1999 UDP packets.

( If ARP_QUEUEING enabled, 2000 UDP packets were sent. )

//*********************************
void udp_test_Sequence(void)
{
  struct ip_addr ipaddr;
  struct netconn *conn;
  struct netbuf *nb;
  INT16U i;
  char str[1400]="1234567890";

  IP4_ADDR(&ipaddr, 192,168,11,120);
 
  conn = netconn_new(NETCONN_UDP);
  netconn_connect(conn, &ipaddr, 12024);
  nb = netbuf_new();
  netbuf_ref(nb,str,1400); 

  for (i=0;i<2000;i++)   netconn_send(conn, nb);
 
  netconn_close(conn);
  netbuf_free(nb);
  netbuf_delete(nb);
  netconn_delete(conn);
}
//**********************************


Have I done anything wrong? Especially about how to use UDP raw API.....


--
************************************************************************
********
Zeng, Ming
NIKHEF,  Kruislaan 409
1098 SJ Amsterdam - The Netherlands
email: address@hidden
Tel.   31 (0)20 592 2147
Mobile 31 (0)6 4351 5283
************************************************************************
******** 





reply via email to

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