| |

VerySource

 Forgot password?
 Register
Search
View: 23|Reply: 1

Error when calling winsock library function bind (): Usually each socket address (...) is only allowed to be used once,

[Copy link]

2

Threads

4

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-3-21 19:00:02
| Show all posts |Read mode
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!
Reply

Use magic Report

0

Threads

21

Posts

18

Credits

Newbie

Rank: 1

Credits
18

 China

Post time: 2020-7-8 10:00:02
| Show all posts
App's systemerror also writes closesocket()
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list