[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [patch #8037] LWIP server fails if we connect multiple clie
From: |
Krantip |
Subject: |
[lwip-devel] [patch #8037] LWIP server fails if we connect multiple clients |
Date: |
Mon, 29 Apr 2013 05:04:19 +0000 |
User-agent: |
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727) |
URL:
<http://savannah.nongnu.org/patch/?8037>
Summary: LWIP server fails if we connect multiple clients
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: krantip
Submitted on: Mon 29 Apr 2013 05:04:17 AM GMT
Category: None
Priority: 7 - High
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
_______________________________________________________
Details:
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;
}
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/patch/?8037>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] [patch #8037] LWIP server fails if we connect multiple clients,
Krantip <=