lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] tcp raw API - accept only one connection


From: Kieran Mansley
Subject: Re: [lwip-users] tcp raw API - accept only one connection
Date: Mon, 28 Jun 2010 09:49:17 +0100

On Sun, 2010-06-27 at 12:09 +0530, Palaniappan Chellappan wrote:
> Dear all,
> 
> I am using tcp raw API, i want to achieve following functionality.
> 
> 1. Listen on port n
> 2. Accept a new connection
> 3. Close Listen port, and don't accept any more connection.
> 4. Process the new connection
> 3. After processing, close connection and go to step 1.
> 
> ***Question:  How to close listening port ? ****
> I tried to call tcp_close(), but the port is still binded, i am not
> able to bind another pcb to same port again.

tcp_close() is the right thing to do.  It should happen straight away.
It would be useful to debug the tcp_bind() call that fails to check
exactly which bit of code is failing.

> Documentation for "tcp_listen_with_backlog()" says "Setting the
> connection to LISTEN is an irreversible process"
> so its not possible to close listening port ?

That means it's not possible to change a listening PCB to a normal PCB
in the same way that you can change a normal PCB to a listening PCB by
calling listen().  You can however close the listening PCB to get it
recycled.

Kieran




reply via email to

[Prev in Thread] Current Thread [Next in Thread]