I ran the command sudo lsof -i -n -P | grep TCP
and I was wondering if I could get some more clarification on its output.
Specifically, in this image:
Why do I have an IP:PORT pointing to another IP:PORT and then back at itself with the label 'ESTABLISHED'? I am confused on what this means exactly.
ESTABLISHED
means that the TCP connection has completed the 3-way handshake. (Not sure though whetheraccept
must have been called). See TCP state diagram.That mean you have two TCP sockets open in your process. Most likely, one listens on port 9092, and another one that connected from port 57633 to that listening socket. Port 57633 belongs to the ephemeral port range, i.e. the range of ports that the OS automatically assigns to the sockets that call
connect
but did not callbind
to assign a specific port.