Windows series of websocket self-starting pit

Windows series of websocket self-starting pit

Hey? Why is my program running and failing? The websocket can't connect after restarting the computer. What the hell is this?

The thing is like this, there is a small program (a program with a small project) that runs on a windows server. If it is a server, it can't be regarded as a server, because it is not a 24-hour standby, so let's call it a server for the time being! We made a websocket service, put it in the windows self-start program, and then started the websocket service every time we booted, and then the web terminal connected to the websocket for two-way communication to complete the response operation!

But the problem lies in the fact that this server needs to be shut down and restarted every day, because my websocket service is placed in self-starting. It happened that I didn't adjust the loading order, but it led to the following problem, the following is the error message:

I reported an error message that the ip binding failed, but the error message should be obvious and should be found soon, but there is still a pit, that is, the above is the error message reported by wamp, it is not a book by coincidence, phpstudy is also loaded but It normally does not display error messages, which is very embarrassing! ! !

This leads to an illusion that there is no problem with the visual program (of course it is still a bit of a problem, otherwise you always have to know the problem of program loading order) Here is my simple and violent method:

I give him a chance to rest, let it rest for 120 seconds, and then execute, that is, every time it is turned on, it does not bind the ip immediately, but sleeps for 120 seconds (loading the network card), and then executes the binding. , So that it can solve the problem of not being able to load and bind

Of course, there is a solution that is to change his loading order (this is left to the small partners to dig by themselves)

Reference: https://cloud.tencent.com/developer/article/1556079 windows series websocket self-starting pit-cloud + community-Tencent Cloud