[Top][All Lists]

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

Re: [lwip-users] TCP_LISTEN_BACKLOG setting problem

From: Mrutyunjay
Subject: Re: [lwip-users] TCP_LISTEN_BACKLOG setting problem
Date: Tue, 22 Feb 2011 18:47:41 +0530

hi Martin,
Thanks for the insight ,

I also came across this in opt.h
 * The maximum allowed backlog for TCP listen netconns.
 * This backlog is used unless another is explicitly specified.
 * 0xff is the maximum (u8_t).
#define TCP_DEFAULT_LISTEN_BACKLOG      0xff //default=0xff

 * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
 * (requires the LWIP_TCP option)
#define MEMP_NUM_TCP_PCB_LISTEN         8  //default=8

in the case of 0 is a invalid value then the lwip should default to TCP_DEFAULT_LISTEN_BACKLOG but not 1

also i thinlk 0 is a valid value ,I have used it before in some previous projects under linux bsd and wince.

I will check again MIN and MAX values of backlog ,

somebody let me know will this it affect anything if I remove ths check.

from BSD manual
If the back_log parameter specifies a value greater than the maximum {SOMAXCONN} allowed, the specified value will be ignored and SOMAXCONN will be used. If the back_log parameter specifies a negative value, the specified value will be ignored and zero will be used.

Mrutyunjay B Patel

On Tue, Feb 22, 2011 at 6:29 PM, Mrutyunjay <address@hidden> wrote:
hi ,
from comment in lwipopt.h is only a flag to enable backloging option  to tcp listening ports ,
not the count of listning as you are saying,
The count of listning queue should be controlled by the second parameter in the listen socket API,

/* Listen on Socket
     * Keep Server on listening mode
    if (listen(server_socket, MAXCLIENT) == -1)

 * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
#define TCP_LISTEN_BACKLOG          0     //Default = 0 == off

also the call flow follows to following net conn api
the comment says
 * Set a TCP netconn into listen mode
 * @param conn the tcp netconn to set to listen mode
 * @param backlog the listen backlog, only used if TCP_LISTEN_BACKLOG==1
 * @return ERR_OK if the netconn was set to listen (UDP and RAW netconns
 *         don't return any error (yet?))
netconn_listen_with_backlog(struct netconn *conn, u8_t backlog)

Mrutyunjay B Patel

On Tue, Feb 22, 2011 at 5:51 PM, Simon Goldschmidt <address@hidden> wrote:

Mrutyunjay <address@hidden> wrote:
> if i set TCP_LISTEN_BACKLOG 0  , I can see 1 active connection and 8 in
> queue , 9th connection is rejected.

Setting TCP_LISTEN_BACKLOG==0 means "disabled". In this case, backlog is limited by the number of PCBs.

> if i set TCP_LISTEN_BACKLOG 1  , I can see 1 active connection and 1 in
> queue.

In lwIP, the listen backlog is the number of incoming connections queued for accept(), meaning once you accepted one connection, another one is free to be queued for the next accept call. Open client connections previously accepted do not count in here.

GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl

lwip-users mailing list

reply via email to

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