Anonymous
Not applicable
Aug 28, 2013
12:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 28, 2013
12:07 AM
I have a question regarding TCP connection on LwIP stack. I have to
implement 5 connection on one port. Let me explain what I do:
wiced_tcp_create_socket - create new scocket;
wiced_tcp_listen - listen on port;
wiced_tcp_accept - wait for accept in new thread
When connected, I start the same procedure but with completly new socket
and listen on the same port as before function wiced_tcp_listen return
WICED_ERROR. I invastigated that netconn_bind return ERR_USE (-13).
It is possible to get more than one connection on the same port?
Labels
- Labels:
-
TCPIP
- Tags:
- accept
- completly
- connected
- connection
- create
- err_use
- explain
- function
- implement
- invastigated
- listen
- lwip
- netconn_bind
- port
- procedure
- question
- return
- scocket
- socket
- stack
- start
- thread
- wait
- wiced_error
- wiced_tcp_accept
- wiced_tcp_create_socket
- wiced_tcp_listen
5 Replies
Anonymous
Not applicable
Sep 03, 2013
12:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 03, 2013
12:52 AM
I invastigated deeply what LwIP do to achieve more than one connection. First, I discovered that ERR_USE comes from tcp_bind (core/tcp.c), so I commented this and achieved 3 connection on the same port. When appliction try to create new fourth socket, wiced_tcp_create_socket return -1 and "memp_malloc: out of memory in pool NETCONN" appear.Also, I played with options in LwIP/wwd/FreeRTOS/lwipopts.h and src/include/lwip/opt.h but no success.How to achieve more than 3 connections? I need 5.
Anonymous
Not applicable
Sep 04, 2013
06:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 04, 2013
06:44 PM
Your second post shows that the failure is due to inadequate memory in the NETCONN pool.Try increasing MEMP_NUM_NETCONN
Anonymous
Not applicable
Sep 10, 2013
05:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 10, 2013
05:48 AM
Exaclly. I increased MEMP_NUM_NETCONN in lwipopts.h and MEMP_NUM_TCP_PCB in opt.h and reach 5 connection.This five connections was established between one client (my PC) and AP. But I also need to connect 5 phones (one connection per phone). And here I met problems. When I try to connect 5 phones to AP, 4 of them obtain IP address and connect to AP but fifth not.Could you explain how to force WICED module to run with 5 phones?
Anonymous
Not applicable
Sep 12, 2013
04:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 12, 2013
04:20 AM
I wonder if my change in LwIP unstable the connections. My changes in LwIP was: if (ip_addr_isany(&(cpcb->local_ip)) || ip_addr_isany(ipaddr) || ip_addr_cmp(&(cpcb->local_ip), ipaddr)) { // return ERR_USE; <------------------- HERE, I REMOVE THIS ----------------- }lwipopts.h:#define MEMP_NUM_NETCONN (16)opt.h:#ifndef MEMP_NUM_TCP_PCB#define MEMP_NUM_TCP_PCB 7#endifCould somebody tell me how this changes influence LwIP stable ???
Anonymous
Not applicable
Sep 27, 2013
08:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 27, 2013
08:42 AM
Im not sure how the change affects LwIP - the code is there to make sure theres just a single socket bound to a given address/port.Currently the WICED SDK doesnt support multiple concurrent TCP sockets - perhaps you could try the following approach: add another wrapper function around netconn_accept() and use separate sockets for the listener and the accepted connections. This way a single listening socket would be kept.Another approach - closing the listening socket after calling wiced_tcp_accept() and opening/binding a new one might not work well due to TCP timewait (more information and an example of what I meant above: http://lwip.wikia.com/wiki/Netconn_bind).