|
The program calls the library function of winsock, and the process is roughly as follows:
1) Create a socket object with socket ()
2) Bind the socket object to the specified address and port with bind ()
3) listen () starts listening
4) closesocket () when closing the program
There is no problem during normal operation, but if the program exits due to an illegal operation before closing it, when you restart the program, you will get an error when running to bind (): "Usually each socket address (protocol / network address / port) Only allowed once ", error number is 10048
And at this time, you can only log out of the operating system and restart it.
I want to know when I judge this error number, is there a method in the socket library function that can release the originally bound port? Experts specify one or two, thank you! |
|