OrkUn Kasapoglu | 23 Jul 14:50 2016

DNS resolver implementation problem

Hello. I'm trying to connect a server with DNS name. I found an example about that in the wikia page of LwIP but I didn't understand it completely.

I can connect my local computer with static ip and messaging with TCP.

I tried to implement the Raw/Native api sample (LwIP wikia) but I didn't understand what is SMTP and where can I find or how can I define it. So the dns_gethostbyname() function always returns ERR_INPROGRESS. I'm new in LwIP and TCP.

Here is my Netif_Config and other functions;

static void Netif_Config(void)
  ip_addr_t ipaddr;
  ip_addr_t netmask;
  ip_addr_t gw;

#ifndef LWIP_DNS
#ifdef USE_DHCP
  ipaddr.addr = 0;
  netmask.addr = 0;
  gw.addr = 0;
  // default ip address settins
  switch(dns_gethostbyname(DNS_HOST_NAME, &ipaddr, smtp_serverFound, NULL))
    case ERR_OK:
// I didn't find any smpt defined something or any extern variable has a name smtp
  /*.. other initializations..*/

void SMTP_serverFound(const char *dns_name, const ip_addr_t *ip, void *args)
  if ((ip) && (ip->addr))
    /*again there are some smtp processes but.......*/

I'm confused about that implementation. How can I get that code working? I've searched it but didn't find anything.

lwip-users mailing list
Erkan Ersoy | 22 Jul 15:59 2016

netconn web server interrupted connections


I have a web serve for my device it works fine but.if I quickly press links make requests one after another
web server speed drops dramatically. and I get
memp_malloc: out of memory in pool TCP_PCB

I think the interrupted pcbs are still taking place in buffer. How do I clean them?

There is thread similar to this said he fixed by increasing MEM_NUM_PCB variable. I think that one is not permanant solution I need to clean them.  And mentioned about some TIME_WAIT variable but I couldn't find TIME_WAIT variable.

Thank you ....

lwip-users mailing list
anmk | 20 Jul 05:15 2016

LwIP deinitialization problem

Hi everyone,
I have problem with LwIP Deinitialization. In my project when i want to use
Ethernet interface i enable power of Ethernet phy(the power of Ethernet phy
is controled by MCU) and then i init LwIP and Ethernet Phy and everything
working well but for the first time. it means when i want to
reinitialization the LwIP and Phy(for next usage), i have an infinite loop
in lwip_init (). because of power saving i have to power on and off ethernet
phy several time in my code (without reseting the MCU).

Is there any routing for deinitializing of LwIP?


View this message in context: http://lwip.100.n7.nabble.com/LwIP-deinitialization-problem-tp26844.html
Sent from the lwip-users mailing list archive at Nabble.com.
Laurent BIERGE | 18 Jul 11:09 2016

raw UDP pcb issue(s)


It seems that when i recieve an UDP message, the UDP input function doesn't find the pcb matching with the message recieved.

I have a client that use POSIX socket on my computer and a server that use LWIP on a remote equipment. I already have a raw tcp echo working.
I've used a simple raw udp echo example on the remote equipment, basically:
in udp_init():
                         udp_pcb = udp_new();
                         udp_bind(udp_pcb, addr, port);
                         udp_recv(udp_pcb, udp_echo_recv());
and in udp_echo_recv():

it didn't worked and after that, i found that most of the time, my messages weren't matching with a local pcb  in udp_input().
So i tried to add specific adresse to udp_bind() and i changed udp_sendto with udp_connect() and udp_send().
I turned ON UDP_DEBUG and it shows me that my pcb is connected and binded to what  i want.

So like i said, most of the time udp_input() don't find matching pcb, but the message is stored.
So when udp_input() manage to match with a local pcb, it calls the callback with the good pcb but with the first pbuf stored.
So basically i got:
send: 1
rcv:...                          ///////// i don't recieve anything, udp_input() doesn't find any pcb matching
.                                   ///////// restarting my UDP client.
send: 2
send: 3
send: 4
rcv: 1                         ///// miracle ! udp_input() find a match, it empty all the buffers stored with this pcb starting with 1. (my programme isn't designed to rcv several
                                 ////// messages  at once but i know for sure that udp_input calls the callback as many times as it has pbufs stored for this pcb)

So my final question is, why doesn't udp_input() find local match all times ? Why does it work with the fourth time and not before ?


lwip-users mailing list
Jan | 13 Jul 15:43 2016

Netconn write and non-blocking

Dear all,

What is the best way to handle the following situation when using netconn in
TCPIP mode and v2.0.0RC1. 

If I connect (with netconn_connect() ) to a device that's not available and
netconn is blocking how long do I have to wait? 

Because it's unknown to me and it could take very long I decided to use the
"netconn_set_nonblocking(conn, 1)" so I can delete the connection if it
takes to long to connect. 

But when the device is available I cannot use the netconn_write() (the
function returns ERR_VAL). In the command it says:

    /* This implies netconn_write() cannot be used for non-blocking send,
       it has no way to return the number of bytes written. */

How can I use netconn_write() in a non-blocking situation?

View this message in context: http://lwip.100.n7.nabble.com/Netconn-write-and-non-blocking-tp26792.html
Sent from the lwip-users mailing list archive at Nabble.com.
Abdul Hakeem | 13 Jul 15:41 2016

0MQ, MQTT and RabbitMQ


Could anyone share their experience(s) of any integration of  LWIP with OMQ,
MQTT and RabbitMQ.

Much obliged,

Abdul Hakeem
Jakub Schmidtke | 13 Jul 02:20 2016

lwIP delays outgoing TCP packets by up to 500ms


I am using lwip with NO_SYS=1, and I have noticed
that outgoing TCP packets are very delayed.

It looks like between writing a packet (using tcp_write),
and the time it actually written to the interface it takes usually about 200ms.

I examined the code, and it looks like lwip only writes regular packets every 500ms.

Basically tcp_write only adds segments to a list, and they are only actually sent inside tcp_slowtmr.
Which, by default, is only called once every two calls to tcp_tmr().
Which gets called every 250ms, so the data being written with tcp_write will be sent out up to 500ms later.

This is a really, really long time!

Am I missing something?


lwip-users mailing list
pischinger | 11 Jul 14:26 2016

lwip 2.0 upgrading

i’m currently working on a project using lwip 1.4.1 stack (raw api with tcpip), and since i’m still in development anyways i thought i might use the newest lwip 2.0 stack instead. Can i just swap them out or how do i “upgrade” to 2.0? Are there any major “bugs” open, since i’ve read that it’s only in beta? Do i have any major benefit from upgrading?
Thanks in advance!
lwip-users mailing list
Sushain Razdan | 8 Jul 14:24 2016

Re: Custom Memory Pool in lwip

On 7/7/2016 3:00 PM, Sushain Razdan wrote:
> Hi,
> Thanks for your reply ! Sorry for replying so late
> I am currently using lwip version 1.4.1 and this version doesn't have
> the Marco LWIP_MEMPOOL_DECLARE as used in httpd.c in the latest
> version, Also I found that memory management is quite different. My
> understanding of the problem is as follows:
> Application i.e. user code declares the custom pools in lwipppools.h.
> This header is in-turn included by memp_std.h which has declaration of
> standard pools. Now memp_std.h is included multiple times in memp.c so
> as to fill up the static memory management variables. Hence I cannot
> include private header files in lwippools.h due to multiple header
> inclusion. Only workaround which I found was to include my private
> headers in memp.c, so that lwip's memory management is aware of what
> structures need to be allocated. This would mean changing lwip's core
> source for application specific needs.
> Can you suggest a better solution keeping the same lwip version ?
> Thanks,
> Sushain


This message and any attachment therewith is privileged, confidential and proprietary in nature and the
property of the originator. It is intended solely and exclusively for use by the individual to whom it is
addressed. It should not be circulated or used for any purpose other than for what is stated. If you have
received this message erroneously, please notify the originator immediately. If you are not the
intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or
disclosing the contents of this message and are called upon to delete the same from your system. Any
contradictory action by you may invite penal consequences. Vihaan Networks Limited accepts no
responsibility for loss or damage arising from the use of the information transmitted by 
 this email including but not limited to damage from virus."
Michał | 7 Jul 15:45 2016

Sending large files over netconn and TCP

I have a website on LwIP with list of files with possibility to download them. I'm using function:

#define BUFFER_OUT                16000
static BYTE archDownBuffer[BUFFER_OUT] __attribute__ ((section(".sdram")));
char archive_page[WEBSITE_BUFFER] __attribute__ ((section(".sdram")));
static BYTE respond[110];
UINT archDownCounter, sentCounter;
FIL arch_file;

void archive_download(struct netconn *conn, const char* filepath)

    FRESULT res;
    archDownCounter = 0;
    sentCounter = 0;
    size_t written;
    int cx;
    err_t test;
    res = f_open(&arch_file, filepath, FA_READ);

    if (res == FR_OK)
        cx =
                snprintf(archDownBuffer, BUFFER_OUT,
                        "HTTP/1.1 200 OK \r\nContent-Type: file/csv\r\nContent-Length: %lu\r\n\r\n",

        netconn_write(conn, (const char* )(archDownBuffer), (size_t )cx, NETCONN_NOCOPY);

        for (;;)
            res = f_read(&arch_file, archDownBuffer, sizeof archDownBuffer, &archDownCounter); /* Read a chunk of source file */
            if (res || archDownCounter == 0)
                break; /* error or eof */
            test = netconn_write_partly(conn, (const char*) (archDownBuffer), (size_t) archDownCounter, NETCONN_NOCOPY, &written);

            if (test != ERR_OK) break; /* error or disk full */
            if (written != archDownCounter) break;

            vTaskDelay(40); //time for other tasks


to send them to a browser but after a couple of iterations the loop and whole stack freezes and LwIP stops working.
With really small vTaskDelay and large BUFFER_OUT there is possibility of Hard Fault pointing to lwip_netconn_do_writemore.

Is there any better method to send large files by netconn?

Michal Golebiowski
lwip-users mailing list
Sandra Gilge | 7 Jul 09:47 2016

Problem with Blackfin Port



I’m not shure if this is the right address to ask about lwip ports.


I struggling with the Blackfin port that I found in the lwip WIKI, so I had a closer look at the code and found following line in the function bfemac_tx_callback():

bfemac_alloc_rxfreequeue(); (line 381)


I’m not completely shure about that, but I don’t understand why bfemac_alloc_rxfreequeue should be called in bfemac_tx_callback


The driver can be found here: http://www.ateis.net/softs/LwIP/


Best regards,







lwip-users mailing list