lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Short but speedy writes


From: Haori Yang
Subject: Re: [lwip-users] Short but speedy writes
Date: Wed, 4 Oct 2006 21:15:15 -0400

Hi, Matthew

  I am sorry that I can't help you with you problem. But can I ask you some question about udp&lwip? I wrote this short code. could you take a look at it? I am getting "undefined reference" error... what header files should be included? Thanks a lot.

 

 #include "xparameters.h"

/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"


extern XEmacIf_Config XEmacIf_ConfigTable[];

int main(void)
{
        struct udp_pcb *local_pcb;
        struct udp_pcb *remote_pcb;
       struct ip_addr ipaddr, netmask, gateway, remoteip;
        struct netif *default_netif;
        char low_mac[3] = {0x00,0x22,0x38};
        unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
        unsigned char ip_address[4] = {149,199,6,108};
        unsigned char ip_remote[4] = {149,199,6,107};
        unsigned char subnet[4] = {255,255,255,0};
        unsigned char gateway_addr[4] = {149,199,6,254};
        struct pbuf *p;
        void *tmpPtr;
        unsigned char buffer[4096] = "beetje flauw\n";
        unsigned char *buffPtr;


sys_init();
mem_init();
memp_init();
pbuf_init();

xemacif_setmac(0, (u8_t *)fullmac);

IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);

netif_init();

udp_init();

 tmpPtr = mem_malloc((mem_size_t)sizeof(struct netif));
 default_netif = (netif *) tmpPtr;
 default_netif = netif_add(default_netif,
                             &ipaddr,
                             &netmask,
                             &gateway,
                             &XEmacIf_ConfigTable[0],
                             xemacif_init,
                             ip_input);
                            
 netif_set_default(default_netif);
 
 
// local_pcb = udp_new();
 remote_pcb = udp_new();
// udp_bind(local_pcb, &ipaddr, (u16_t)8080);
 udp_connect(remote_pcb, &remoteip, (u16_t)8080);
 
 p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
 p->payload = buffer;

 
 for (;;)
 {
     udp_send(remote_pcb, p);
 }

  return 0;

}

 

On 10/4/06, Matthew Yingling <address@hidden> wrote:
Hello,

I am implementing a Microblaze application using LwIP that reads and writes
very short data streams via TCP.  I'm writing eight bytes from a PC to the
Microblaze running LwIP, and then LwIP sends out a single (data) byte back.
I'm finding this painfully sluggish for such low data, on the order of
tenths of seconds or longer.  I think both the PC with a Win32 WinSock2
application and LwIP might be to blame.

I can stream UDP data at nearly a megabyte per second using LwIP, but that
is using large ~1472 byte packets, so the physical link is ok.

My approach was to use tcp_write(), but I have started following it with
tcp_output() to force the data onto the wire immediately.  Is this the
correct approach?

This may be off topic, but does anyone have pointers on optimizing speeds on
WinSock2 with very short data streams?

Thanks,
Matthew Yingling



_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

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