[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Understanding Raw TCP PCB allocations.
From: |
address@hidden |
Subject: |
Re: [lwip-users] Understanding Raw TCP PCB allocations. |
Date: |
Mon, 26 Apr 2021 21:37:00 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 |
Am 26.04.2021 um 21:24 schrieb Luciano Moretti:
> Hello,
> I'm trying to make sure I understand what's going on.
>
> Here's my understanding:
>
> When I create a listening connection:
> 1. I pass a PCB to tcp_listen(). The passed PCB gets deallocated and a
> new listening PCB is returned.
> 2. When a client connects to my listening socket the accept callback is
> called with a NEW session PCB. The listening PCB is still in existence.
> 3. When I "close" the active TCP connection, I should close the New
> Session PCB that was allocated in 2.
> 4. The listening PCB created in step 1 is still listening and will
> accept any new connections.
> 5. When I want to stop listening, I need to call tcp_close() on the
> listening PCB allocated by tcp_listen() in 1.
>
> So I'm going to have to manage both the listening PCB and an active
> connection PCB for a "listening" socket?
Yes, that's just the same as if you had sockets instead of our pcbs...
Regards,
Simon