[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] 答复: how to release allocate d TCB
From: |
vincent cui |
Subject: |
Re: [lwip-users] 答复: how to release allocate d TCB |
Date: |
Sat, 21 Jul 2012 03:29:00 +0000 |
All:
When application block in lwip_accept, I can delete it and create it
successfully, then connect it successfully.
When application block in lwIP_recv, I can delete it and create it fail. It
always returns -1 in lwIP_accept
lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
{
struct lwip_sock *sock, *nsock;
struct netconn *newconn;
ipX_addr_t naddr;
u16_t port = 0;
int newsock;
err_t err;
SYS_ARCH_DECL_PROTECT(lev);
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
sock = get_socket(s);
if (!sock) {
printf("accept socket fail\n");
return -1;
}
It seems that last threads resource is not be released ,right ?
Vincent
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Simon Goldschmidt
Sent: 2012年7月21日 6:27
To: Mailing list for lwIP users
Subject: Re: [lwip-users] 答复: how to release allocated TCB
Kieran Mansley <address@hidden> wrote:
>
> On 20 Jul 2012, at 15:35, vincent cui wrote:
>
>> Hi:
>>
>> I use socket api to do that.
>
> Is it possible that the old socket is just in the TCP TIME_WAIT state, and
> will be cleared up after a short while? If you're calling close() on your
> sockets, that is all you should need to do.
That sounds like a good explanation: from the original post, I think he closed
the listening socket and reopened it and called listen() again. I think that
really doesn't work as long as there are old connections in time-wait, so
trying to create the listening socket again after 2 minutes should probably
succeed...
Simon
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users