Http server app max sockets

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

When starting a sever WICED frameworks API wiced_http_server_start () takes a max sockets parameter.  Our application requires only 1 client connection at a time so I assume then the input parameters for max sockets should be set to 1. In general this seem to work, when set to 1 I can connect and browse with one device, simultaneously another device can connect but the browser times out waiting for a page to be served. I have 2 questions related to this:

1. Does number of sockets affect "anything else"?  Specifically one of the client devices I test with (iPhone) is unusable because browser pages render so slowly when max sockets set to 1. When I have this set to 10, as in most of the WICED examples, the page renders are fine.

2. I assumed setting max sockets to 1 would allow only 1 device to wifi connect, which is not the  case.I can wifi connect with a second device, but I can not browse with that device as the browser times out.

0 Likes
1 Solution
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

max_sockets in wiced_http_server_start() API stand for maximum number of sockets to be served simultaneously. If you check the underlying implementation, it is essentially creating the transport layer sockets for which the memory allocation is done dynamically based on the number of simultaneous connections required; i.e number of sockets. I tested with the snip.http_server_sent_events example. With the max_sockets set to 1, I could not connect to the http server from more than one client device (connection times out. Maybe you can tell me the connection event you are seeing it in a wireshark trace).

So for the rendering issue, what is the stack size you are using? I tried to connect again through the same example but could not see the rendering issue.

View solution in original post

0 Likes
4 Replies
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

max_sockets in wiced_http_server_start() API stand for maximum number of sockets to be served simultaneously. If you check the underlying implementation, it is essentially creating the transport layer sockets for which the memory allocation is done dynamically based on the number of simultaneous connections required; i.e number of sockets. I tested with the snip.http_server_sent_events example. With the max_sockets set to 1, I could not connect to the http server from more than one client device (connection times out. Maybe you can tell me the connection event you are seeing it in a wireshark trace).

So for the rendering issue, what is the stack size you are using? I tried to connect again through the same example but could not see the rendering issue.

0 Likes
Anonymous
Not applicable

Thanks.

As far as teh rendering issue....

I experimented with different stack sizes, from  5000 all the way up to 10000, but that did not matter. The rendering issue may also be related to IPhone. I recreated the problem connecting an iPhone and using one of the sample apps....

I modified the apsta example application to only create a server with AP interface and running on an MXCHIP  EMW3166 development kit.  I am connecting to it with an IPhone 6, iOS 11.2, running Chrome (latest version). When I create the server with the original max sockets parameters set to 10 then connect / browse with my iPhone, the page refreshed instantaneously. When I rebuild the application with max sockets set to 1, it can take 1 minute for the page to fully render or refresh. Sometime the browser times out waiting for the page.

0 Likes
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

I don't have your eval kit with me but I checked with CYW943907AEVAL1F kit and was not able to reproduce the same.

AxLi_1746341
Level 7
Level 7
10 comments on KBA 5 comments on KBA First comment on KBA

Which network stack are you using? NetX/NetX_Duo/LwIP?

0 Likes