Meaning of lsof -i output

lsof

Solution

If there is an established TCP connection, lsof actually displays TCP socket data. If two local processes communicate with each other via TCP, there is an open socket in each. The first HOST:PORT shows the process' own socket and after the `->` the connected remote socket is shown in the other process.

For known standard ports, the numbers are replaced with names.

When you establish a TCP connection with a server, your client program uses a random source port number. That's 46265.

The format is:

PROCESS    OTHER
HOST:PORT->HOST:PORT

Problem

I have run the command ``` sudo lsof -i tcp:46265 ``` Output ``` COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 4580 mysql 30u IPv4 70185524 0t0 TCP localhost:mysql->localhost:46265 (ESTABLISHED) java 53105 root 54u IPv6 70185523 0t0 TCP localhost:46265->localhost:mysql (ESTABLISHED) ``` Can someone explain what localhost:mysql->localhost:46265 and localhost:46265->localhost:mysql mean ?

Original source