[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] tcp_connect and tcp_listen problems
From: |
Florian Schulze |
Subject: |
[lwip-users] Re: [lwip] tcp_connect and tcp_listen problems |
Date: |
Thu, 09 Jan 2003 01:15:35 -0000 |
> Yes, tcp_connect() shouldn't pick a new local port if one already is
> assigned. Thanks for pointing this out! Your application uses tcp_bind() to
> bind to port 20 (I assume), and tcp_connect() didn't check if the port was
> already bound. This has been fixed in the latest CVS version.
Will test it, thanks.
> The second problem *might* be because the return value of tcp_listen() must
> be used instead of the value fed into the function. Like this:
>
> tcp_pcb *pcb;
> pcb = tcp_pcb_new();
> tcp_bind(pcb, ipaddr, port);
> pcb = tcp_listen(pcb);
>
> The reason is that a listening connection uses less memory so it is
> reallocated when it is put in listening mode.
I'm doing exactly that.
Shouldn't there be a check for the return value of tcp_listen, so the original
pcb can be freed correctly?
> That certainly is the main advantage of using the raw api: support for
> multiple connections comes for free!
The only thing one has to understand, is that the state for every connection
needs to be saved. In my ftp implementation for example, I have to save the
current working directory for every connection.
Florian
[This message was sent through the lwip discussion list.]