I am working on a Python Server application that runs on 127.0.0.1 : 555 and I am trying to show the port 555 on lsof, or netstat. My system is macOS and when I type
sudo lsof | grep localhost
on terminal, I cannot see the port as localhost:555 instead the end of the output looks like:
... TCP localhost:dsf (LISTEN)
Can someone help me about what 'dsf' means and is there any way to show the port 555?
Thank you.
Port numbers <1024 are what are known as "well-known port numbers" (and are usually not able to be instantiated by non-privileged users). I'm not sure where you'd look on macOS, but on Unix machines, there is typically a file in /etc called "services" which provides names for many of those well-known ports. Many utilities use this file to look up names for those ports and display the name rather than the port number. I don't know what 'dsf' is, but it is reserved as such (see the IANA assignment here). There may be a command line switch to lsof to tell it to always use the port number rather than the name.
As an aside, unless you have a very good reason for doing so, it's generally considered a bad idea to run services on ports < 1024.