tig / mcec

Robust remote control of Windows PCs over the network.
https://tig.github.io/mcec/
MIT License
80 stars 13 forks source link

Server error which MCEC is killed and then reopened #3

Closed wayner9 closed 5 years ago

wayner9 commented 6 years ago

It seems that if the MCEC application is closed while a server is active then when you restart MCEC with the server function enabled that you get an error. It reports:

Server: Error Server: Stopped

If I first disable the server and then exit the application this problem does not occur. If I change the port to a different number then the server can successfully run. This behavior appears to be the same in both Win7 and Win10.

Maybe the port is somehow locked?

Any ideas how to fix this? I have not tried rebooting to see if that fixes the problem, but that shouldn't have to be done.

wayner9 commented 6 years ago

Some further work on this. when I use netstat I can see that for some reason some previous ports for MCEC are still listening. Here is the output of netstat -a -n -o TCP 0.0.0.0:5150 0.0.0.0:0 LISTENING 37296 TCP 0.0.0.0:5155 0.0.0.0:0 LISTENING 46952 TCP 0.0.0.0:5156 0.0.0.0:0 LISTENING 17796 TCP 0.0.0.0:5160 0.0.0.0:0 LISTENING 17320

So it looks like MCEC is not nicely closing the port when it is closed with the server active. This does NOT happen when you disable to server before closing MCEC. I can manually kill these tasks using a command such as "taskkill /f /im 17320".

It seems like after a while these processes will die off but it is hard to figure out how long this timeout is.

Why is this issue a problem? I was trying to figure out how to do some changes to the commands file. I believe that you have to restart MCEC to get it to reload the commands file. So if you close and reopen MCEC then you have this problem. I now know that you should disable the server before stopping but that isn't obvious. Is it documented anywhere? I didn't see it.

tig commented 5 years ago

I think this is fixed in v2. Look for beta 2 to be uploaded soon.

tig commented 5 years ago

I can not reproduce this with v2. Please give it a try.