We can't use close to release the port resource. The close function just decrease the reference count and the actual cleanup is performed by the OS.
In our test cases:
we create a socket and and
bind it to a port selected by OS kernel
extract the port from the socket and then return it
close the socket
5. we assume that the port resource is available
We cannot ensure the fifth expectation is true, because the release of the port is not performed by the close function, it's released by the system when it sees the reference count to this socket is zero.
So, we must add some machanism to wait for the system releasing the port resource.
We can't use close to release the port resource. The close function just decrease the reference count and the actual cleanup is performed by the OS.
In our test cases:
We cannot ensure the fifth expectation is true, because the release of the port is not performed by the close function, it's released by the system when it sees the reference count to this socket is zero.
So, we must add some machanism to wait for the system releasing the port resource.
@k4nar