> Hi!
> I want to use lwip 1.3.2 to support multiple sessions in a embedded system.
> But I foud it is so inefficient to use the api select when there are 64 sockets as clients.For example,a modbus client socket can only do the receive data after all the 64 sockets finish sending.
> will anyone can help me to solve the problem.
No, I don't think we have anything like WSAAsyncSelect.
> ps:in my case,64 clients sockets will send data at the same time and the sever may not respond at once,so for a socket,it will receive the packet from the server after a really long time
I'm not sure I fully understand your application. Can you give an example of how you're calling select. I didn't think lwIP supported that many sockets in the select set for example.
Kieran
_______________________________________________
lwip-users mailing list
lwip-...@nongnu.org
http://lists.nongnu.org/mailman/listinfo/lwip-users
I'm assuming this is a nonblocking connect?
> select(65,readset, writeset,errset, 0);
> for(i=0;i<TCP_CLIENT_LINK_TOTALS;i++)
> {
> if (FD_ISSET(clientsocket[i].socket, writeset))
> send();
> if (FD_ISSET(clientsocket[i].socket, readset))
> receive();
> }
> }
> When TCP_CLIENT_LINK_TOTALS is equal 16,it works well.But when it is
> equal 64,it will cost more than 100 ms for a socktet to receiver something.
I wouldn't have thought that the select implementation is the limiting factor here. Are you sure you did not run into memory limitations somewhere? Specifically, you need to set MEMP_NUM_NETCONN high enough as well as have enough pbufs, heap memory and tcp segments. Did you check the stats that there is no error (all 'err' members should be 0)?
While our select implementation might be somewhat suboptimal, 64 sockets should not be a problem at all. I'll see if I can write a test for this.
Simon
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
>I wouldn't have thought that the select implementation is the limiting factor here. Are you sure you did not run >into memory limitations somewhere? Specifically, you need to set MEMP_NUM_NETCONN high enough as well as >have enough pbufs, heap memory and tcp segments. Did you check the stats that there is no error (all 'err' >members should be 0)?
>While our select implementation might be somewhat suboptimal, 64 sockets should not be a problem at all. I'll >see if I can write a test for this.
I also have done some tests for this issue. I edite the "charge" programe so that it can echo the request of the modbuspoll.the lengthe of the request packet data is 12 Bytes,and the one of the echo's is 250 Bytes.I use the wireshark to capture the traffics.there is the result.
If there are 64 active connetions and only 1 connetion has traffics,the ack time is among 1~54 ms,and the usual valuse is 2 ms.
If send a arp begin the first "for" cycle,and observe the time between two arp packets,the the time is among 1~154ms.
In fact,it is ok if everything is done in my own modbuspoll program and the throught may achieve 2000pps.But the actual application is that a 10ms thread decide what to send and to see if have something received and other correlative process. So,in some case,my modbuspoll will send 64 packets first,then do the receive in the next "select". As the result it is maybe too inefficient.
It must be difficult to understand my application,maybe you can see the program for example? Thanks very much.
The file "tcpclient.c" is my test program.the 10ms thread is just like the function below,of courese more complex .
void TaskRun(void *pData)
{
U8 byErr = 0;
U8 i = 0;
while(TRUE)
{
pMsg = (U32*) OSQPend(AppArray, 0, &err);//every 10ms
for(i=0;i<64;i++)
{
if(recvflag[i])
{
sendflag[i] = 1;
recvflag[i] = 0;
}
}
}
}
Simon
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
_______________________________________________