Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't package react native because of port 8081 sunproxyadmin

when I run this in terminal:

lsof -n -i4TCP:8081

I get this

node      10901 me   28u  IPv6 0xbcad49      0t0  TCP *:sunproxyadmin (LISTEN)
foo 11957 me   15u  IPv4 0xbcad49      0t0  TCP 127.0.0.1:61127->127.0.0.1:sunproxyadmin (CLOSE_WAIT)

What is this sunproxyadmin?

like image 966
SuperUberDuper Avatar asked Oct 07 '15 22:10

SuperUberDuper


1 Answers

Per http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=8081, TCP port 8081 is the well known port for sunproxyadmin the same way 80 is the well known port for http. In this case, you have a node process that is listening on port 8081, but lsof is trying to be helpful and show the well known port for this. Under linux, this is defined in /etc/services; I would expect OS X is similar.

Edit 1: Note that per Apple Man Pages, passing -P

inhibits the conversion of port numbers to port names for network files.
Inhibiting the conversion may make lsof run a little faster. It is also useful when port name lookup is not working properly.

This should cause lsof to not print out the confusing sunproxyadmin for something that just happens to use the port that Sun registered.

Edit 2: The second column in your response (e.g. 10901 in the first row, which is the one you want, and 11957 in the second row) should be the process ID. If you do ps aux | grep 10901 (or ps elf | grep [pid], as I can't remember which works right for OSX and don't have it handy) you should get something like:

apache 19783 0.0 0.2 251888 8580 ? S Oct07 0:00 /usr/sbin/httpd -DFOREGROUND

(or to make something up:

nodeuser 10901 0.0 0.2 251888 8580 ? S Oct07 0:00 node index.js

)

You can kill it with kill -9 10901 (or whatever the PID was) though you might find it comes back if it's running as a service or what.

This is useful enough to add to your bash profile:

function findbyport()
{
  sudo lsof -P -iTCP:$1 -sTCP:LISTEN
}
like image 186
Foon Avatar answered Oct 02 '22 21:10

Foon