简体   繁体   中英

How port can close when Im close the program

I dont want to change port number , but I receive an exception "Exception in thread "main" java.net.BindException: Address already in use: JVM_Bind"

ServerSocket server = new ServerSocket(1234, 180);

You have another process bound to the same port.

If you are using Windows then open CMD and run this command

netstat -aon | findstr 1234

you will get the process ID which you can find in task manager which is using that particular port. ie 1234 in your case

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM