I opened port #5955 from a java class to comunicate from a client. How do i close this port after I am done? and also which command can show me if port open or closed?
相关问题
- Xcode debugger displays incorrect values for varia
- Is there a way to report errors in Apple documenta
- Advice for supporting both Mac and Windows Desktop
- Avoid cmake to add the flags -search_paths_first a
- Port of the Rails app when running Cucumber tests
相关文章
- 现在使用swift开发ios应用好还是swift?
- Visual Studio Code, MAC OS X, OmniSharp server is
- xcode 4 garbage collection removed?
- IntelliJ IDEA can't open projects or add SDK o
- Automator: How do I use the Choose from List actio
- ImportError: No module named twisted.persisted.sty
- How can I vertically align my status bar item text
- git command-line on Mac OS error “dyld: Symbol not
First find out the Procees id (pid) which has occupied the required port.(e.g 5434)
ps aux | grep 5434
2.kill that process
To find the process try:
Kill the process which is currently using the port using its PID
and then check to see if the port closed. If not, try:
I would only do the following if the previous didnt work
Just to be safe. Again depending on how you opened the port, this may not matter.
You can also use this first command to kill a process that owns a particular port:
For example, say this process holds port 8000 TCP, then running the command:
will output the line corresponding to the process holding port 8000, for example:
In this case, procHoldingPort is the name of the process that opened the port, 4683 is its pid, and 8000 (note that it is TCP) is the port number it holds (which you wish to close).
Then kill the process, following the above example:
As others mentioned here out, if that doesn't work (you can try using kill with -9 as an argument):
Again, in general, it's better to avoid sending SIGKILL (-9) if you can.
Cheers,
Guy.
Find out the process ID (PID) which is occupying the port number (e.g., 5955) you would like to free
Kill the process which is currently using the port using its PID
When the program that opened the port exits, the port will be closed automatically. If you kill the Java process running this server, that should do it.
try below, assuming running port is
8000
:I found the reference here