Earlier quoted context omitted.
I wish SRV records were more widely adopted, but they are still just a (string -> integer) mapping process above the 16-bit integer values on the wire. Different layers.
And? That's primarily what DNS is for: mapping strings to numbers.
Testing if a port can be reached, using built-in tools other than ol' telnet
81–87 of 87 posts
Re: Testing if a port can be reached, using built-in tools other than ol' telnet
#82Re: Testing if a port can be reached, using built-in tools other than ol' telnet
#83Earlier quoted context omitted.
> The proposal to use names and not numbers breaks down when you want the rest of the world to follow suit, because it's not technically possible within IP, only on top of IP. This is exactly my point.
> > The proposal to use names and not numbers breaks down when you want the rest of the world to follow suit, because it's not technically possible within IP, only on top of IP. > This is exactly my point. In which case, refer to my original response to your proposal - it's not practical to slow down every networking device in the world by a large factor. It's like asking "why aren't we commuting at 1/3 the speed of…
Re: Testing if a port can be reached, using built-in tools other than ol' telnet
#84Ha! This was probably the first serious problem I ever tackled with an open source contribution! The year was 2002, the 2.4 Linux kernel had just been released and I was making money on the side building monitoring software for a few thousand (mostly Solaris) hosts owned by a large German car manufacturer. Everything was built in parallel ksh code, “deployed” to Solaris 8 on Sun E10Ks, and mostly kicked off by cron.…
Netcat even has port scanning capabilities.
Re: Testing if a port can be reached, using built-in tools other than ol' telnet
#85Kind of unrelated but here's a little bit of bash I use for checking this locally: # Check if the port is available is_port_free() { if [[ "$1" =~ ^[0-9]+$ ]] && [ "$1" -ge 1024 ] && [ "$1" -le 65535 ]; then echo "Valid port number." >&2 else echo "Invalid port number." >&2 return 1 fi if netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ":'$1'$" {exit 1}'; then # Return a truthy value if the port is available return 0 else…
Re: Testing if a port can be reached, using built-in tools other than ol' telnet
#86Earlier quoted context omitted.
that is so cool, my god! Bash is this awesome underrated thing (relative to how I perceive it being used). It's so cool that there's basically a virtual filesystem that maps the internet to your disk...haha. This even works on my Mac. But one issue I encountered was timeout. I just tried: : and it hung. So I asked ChatGPT and it suggested timeout 5 bash -c ':
There isn't a virtual filesystem; bash just pretends there is. You can't use the /dev/tcp path in your own program as it doesn't exist.
Yeah, I didn't know that. I definitely had a suspicion it was how you say, and "basically" was my fudge word, because I didn't know. I hadn't thought much about it, but I did not know for sure. Thanks for tellin me.
I've thought about this idea: mapping the internet to the Unix filesystem, a la proc. I know TabFS, but I think the mapping could be better.
I think it's an interesting problem to consider what a good mapping would be. But it's all tradeoffs I guess. I haven't thought that much about it. But it did seem interesting.
Maybe not interesting enough to really commit to, because it seemed kinda like a big project. But definitely interesting to consider. What do you think? What kind of mapping would you do?
Re: Testing if a port can be reached, using built-in tools other than ol' telnet
#87Kind of unrelated but here's a little bit of bash I use for checking this locally: # Check if the port is available is_port_free() { if [[ "$1" =~ ^[0-9]+$ ]] && [ "$1" -ge 1024 ] && [ "$1" -le 65535 ]; then echo "Valid port number." >&2 else echo "Invalid port number." >&2 return 1 fi if netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ":'$1'$" {exit 1}'; then # Return a truthy value if the port is available return 0 else…
netstat seems to be disappearing from some linux distros - pretty sure it's not on my current Ubuntu by default, so I have to use 'ss' instead (which does seem to be quicker).