I am using CALLBACK API and set up a pcb using
tcp_new() followed by tcp_bind() followed by tcp_listen() &
tcp_accept(). In my accept() for a valid connection I use tcp_close()
to close the LISTEN connection to avoid any additional connection requests for a
new connection. When I am done using the connection I use tcp_close() to
shut it down and then repeat the process with tcp_new() to start a new LISTEN
port. My problem is 2 fold.
First I find that the 2nd time through the
tcp_bind() function I get an ERR_USE return which appears to be caused by the
active list of pcb still having the old port number in it. I think ther is
a problem with tcp_bind() which causes this to happen.
Secondly (and the biggest problem) is that once I
get the ERR_USE then I have a pcb allocated and this consumes pcb space and I
eventually run out of space. So the question is, if I get an error with
tcp_bind() how can I release the pcb allocated by the tcp_new() so I do not
consume pcb memory space and fill it up. I think there could be a problem
with tcp_bind() giving this error which is also an issue. Can anyone
suggest how to approach these problems?
Rick
|