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

nmap scan stops MicroWebSrv #44

Closed
dl2080 opened this issue Sep 26, 2018 · 3 comments
Closed

nmap scan stops MicroWebSrv #44

dl2080 opened this issue Sep 26, 2018 · 3 comments

Comments

@dl2080
Copy link

dl2080 commented Sep 26, 2018

Hello,
thank you for this nice web server project!

I'm using nmap to discover devices in my network. However, as soon as I start the scan in the linux console, MicroWebSrv on my WiPy 3.0 stops working. After that, restarting the server with srv.Start() fails due to [Errno 12] ENOMEM. I found that I need to close the socket first. srv.Stop() will not help, because it closes only, if srv._started is true, which is not the case. Maybe this can be changed? srv._server.close() helps. After that a restart of the server is possible without reseting the whole device.

To trace the cause of the server stop error, I changed the try/except block in microWebSrv.py line 239 to

try :
   client, cliAddr = self._server.accept()
except Exception as e :
   print(str(e))
   break

I get [Errno 128] ENOTCONN when nmap starts.

It seems some connection is being lost. Is there a way to prevent MicroWebSrv from stopping at this position?

nmap has version 7.60
wipy firmware is 1.19.0.b4
micropython has version 1.9.4
Server is started with:

srv = MicroWebSrv(routeHandlers = routeHandlers)
srv.MaxWebSocketRecvLen = 256
srv.WebSocketThreaded = True
srv.AcceptWebSocketCallback = _acceptWebSocketCallback
srv.Start(threaded = True)
@jczic
Copy link
Owner

jczic commented Oct 11, 2018

Hello,
Yes I see that ! I've just updated the code to close server only if the error code is 113 (normal closing socket).
You can check at : 5074d96
That's ok for you ?
Thanks !

@dl2080
Copy link
Author

dl2080 commented Oct 11, 2018

Yes, it doesn't crash anymore!
Great! Thanks a lot!

@dl2080 dl2080 closed this as completed Oct 11, 2018
@jczic
Copy link
Owner

jczic commented Oct 20, 2019 via email

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

2 participants