patchlwIP - A Lightweight TCP/IP stack - Patches: patch #8037, LWIP server fails if we connect...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #8037: LWIP server fails if we connect multiple clients

Submitter:  Krantip <krantip>
Submitted:  Mon 29 Apr 2013 05:04:17 AM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Invalid Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Planned Release:  None

Wed 19 Jun 2013 08:05:08 PM UTC, comment #1: 

This entry is wrong here:
- you did not provide a patch. Patches are a way to tell us what to change in the sources.
- you have a problem in using lwIP. You're better off trying to get support on lwip-users.
- most likely, you have a problem in configuring lwIP. I understand that this is not an easy task, and I'd love to get a better documentation of this (someday).

- last but not least, this is totally not high priority. It might be high prio for you, but the priority entry is meant to sort patches against each other.

Closing as invalid, sorry.

Simon Goldschmidt <goldsimon>
Group administrator
Mon 29 Apr 2013 05:04:17 AM UTC, original submission:  

I am using LWIP stack version 4.0.My requirement is,connect minimim 50 clients to lwip server using single thread.
Single client server is working fine,but if i connect 2-3 clients,then after some time,I found , tcp_write out of memory error,because of TCP_SND_QUEUELEN gets over.
I get below error,when it shows tcp-write error.
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_write: too long queue %"U16_F" (max %"U16_F")\n",
***********************************************************
MY opt.h settigs as below,
#define TCP_TMR_INTERVAL                250
#define TCP_SND_BUF                     5840
#TCP_MSS                                1460
#define MEM_SIZE                        64000
#define MEMP_NUM_TCP_PCB                16
#define MEMP_NUM_TCP_PCB_LISTEN         50
#define MEMP_NUM_TCP_SEG                50
#define TCP_WND                         (4 * TCP_MSS)
#define TCP_SND_QUEUELEN                ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
*************************************************************
My server code is as folllows,

signed int prvxMBTCPPortReceive(void *arg, struct tcp_pcb *pxPCB, struct pbuf *p, signed int Err)
{

unsigned char *pModbusHeader;
u16_t len;
signed int Error;
tcp_nagle_disable(pxPCB);
if( Err != ERR_OK )
{
return Err;
    }
    if( p == NULL ) // If pbuf is NULL then remote end has closed connection.
{
prvvMBPortReleaseClient( pxPCB );
return ERR_OK;
    }

len = p->tot_len;
pModbusHeader = p->payload;


MODTCP1 = ((struct mod_tcp_hdr1 *)pModbusHeader);
Trans_id = MODTCP1->trans_id;
Proto_ID = MODTCP1->proto_id;
Len = MODTCP1->len;
tcp_recved(pxPCB, p->len);
tcp_tmr();

memcpy( Comm3Buff, pModbusHeader + 6, (unsigned short) *(pModbusHeader + 5) );
ReceiveBuffLength3 = len - 6;
ProcessSerialIntr3();

MODTCP1 = ((struct mod_tcp_hdr1 *)&RxBuff[usTCPBufPos]);
MODTCP1->trans_id = Trans_id;
MODTCP1->proto_id = 0;
MODTCP1->len =  htons((unsigned short)(FrameLength3-1));

memcpy( &RxBuff[usTCPBufPos + 6], Comm3Buff, (unsigned short) (FrameLength3 - 1) );


if( (Error = tcp_write( pxPCB, RxBuff, (unsigned short) (6+FrameLength3-1), 01 )) == ERR_OK )
{
( void )tcp_output( pxPCB ); Make sure data gets sent immediately
}
else
{
prvvMBPortReleaseClient( pxPCB ); // Drop the connection in case of an write error.
}
usTCPBufPos = 0; // Reset the buffer
pbuf_free( p );
return ERR_OK;
}

Krantip <krantip>

 

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

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 goldsimon (Posted a comment)
  • -email is unavailable- added by krantip (Submitted the item)
  •  

    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.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-19 goldsimon Priority7 - High 5 - Normal
        StatusNone Invalid
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code