lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] SOF_REUSEADDR & SOF_REUSEPORT


From: Kjell Andersson XW (LI/EAB)
Subject: [lwip-users] SOF_REUSEADDR & SOF_REUSEPORT
Date: Tue, 13 Jan 2004 11:18:37 +0100

I'm having a problem with SOF_REUSEADDR and SOF_REUSEPORT.

I'm setting up one server side and one client side which connects to the 
server, both binding to a local port and address. When the server accepts an 
incomming connection, it stops listening (closes the pcb).
The server side then disconnects and leaves the pcb for that side in TIME_WAIT 
state, while the client side gets disconnected and the pcb removed. All fine.

The problem now occurs when I want to restart the procedure all over by setting 
up server and client, both binding and using SOF_REUSEADDR and SOF_REUSEPORT to 
be able to rebind.
The problem now occurs when the client side shall connect to the server side. 
Since a new listen pcb has been created we now have two pcb's for the same port 
and address combination, one in TIME_WAIT and one in LISTEN. When the incomming 
connection from the client arrives to the server side, the TIME_WAIT pcb gets 
the connection (SYN) request. That pcb then responds with an ACK to the client. 
The clients sees the ACK and thinks it is a correct connection ACK and moves to 
ESTABLISHED state. The server pcb that is in state LISTEN never sees the SYN 
request.

I now have a client side which thinks he is connected and a server side that 
does not think so.

The problem occurs only because I have bound my client to a local port number. 
If I don't bind it, or bind it to port 0, and let the stack choose a port 
number it all works ok. The problem is that I, in my very special application, 
want to bind the local port number.

My question: How is TCP supposed to handle a case like mine? Is lwIP acting 
according to specification?

I using the DEVEL branch of lwIP 0.6.5.

 / Kjell





reply via email to

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