Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't close socket #19

Open
erde-hoon opened this issue Nov 27, 2017 · 5 comments
Open

doesn't close socket #19

erde-hoon opened this issue Nov 27, 2017 · 5 comments

Comments

@erde-hoon
Copy link

HttpServer.Dispose(); is not working properly

Listening once, and Dispose it, and after that it cannot listening again on same port.

@shanielh
Copy link

Dispose() is "eventually" disposing the socket (not waiting for the socket to close)

My suggestion is that you wouldn't re-create server instances in the same process, instead, you can change the logic of the server by creating a "Box" Handler and changing his underlying handler in run-time.

@shanielh
Copy link

Actually, You're right, the IHTTPListener should implement IDisposable and allow you dispose the underlying _listener. But the server wouldn't do it for you.

@gavazquez
Copy link

I did a pull request for that as otherwise if you reload the dll you get this issue

@Psilax
Copy link

Psilax commented Apr 25, 2019

This is not a bug of Dispose but of the socket implementations.
You have to add
tcpListener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
when setting up the tcp listener

@smaudet
Copy link

smaudet commented Feb 25, 2024

Cross commenting but its worse than that, the ssl listener appears to do some unsafe stuff leaking clients and ssl ports...

I'm considering switching/re-writing the whole library, there's so much missing/wrong at this point. Its good if you just want to start a server, and write a lot of routing logic yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants