[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] Repeated tcp_bind calls
From: |
Russ Dill |
Subject: |
Re: [lwip-devel] Repeated tcp_bind calls |
Date: |
Tue, 10 Jun 2014 05:36:16 -0700 |
Sorry, false alarm, I needed a make clean.
On Tue, Jun 10, 2014 at 5:32 AM, Russ Dill <address@hidden> wrote:
> I'm trying to reuse a port, but it looks like I'm having to wait for a
> time wait timeout as tcp_bind returns an error.
>
> My sequence is
> listen {
> lpcb = tcp_new
> ip_set_option(lpcb, SOF_REUSEADDR)
> tcp_bind(lpcb, addr, port)
> lpcb = tcp_listen(lpcb)
> tcp_accept(lpcb, accept)
> }
>
> [...]
>
> accept(pcb) {
>
> /* repeated accept calls don't make sense in out application, close
> the listen pcb */
> if (tcp_close(lpcb) < 0)
> tcp_abort(lpcb)
>
> < talk on pcb, eventually close >
> }
>
> After a listen/accept cycle has happened and accept has closed its
> pcb, I'll try calling listen again, but bind will give me a failure
> until some timeout. Is there any way to get around this? I have
> SO_REUSE defined.