OT: Algorithm for port open test
Posted: Thu May 10, 2012 7:10 am
Over the years, I've had a lot of problems with closed ports. I've gotten pretty good at fixing these (with help from this forum) once I figure out/notice that the port's closed. To that end, I want to write a piece of code (preferably in bash) that will test a port for open/closed. I'll use it to put something on my desktop or notifier to alert me to the problem.
Since Transmission already has code like that (Preferences-> Network->Test Port), I was hoping someone could tell me how it works. I probably don't know the language Transmission is written in, but I do know enough programming languages to mudde through foreign code and get a fair idea of what it's doing if I have to.
I have a notebook (kubunbtu oneiric (11.10) Linux x86) that uses dhcp, so I don't have a static IP and the IP varies depending on where the notebook is anyway.
So far, the hard part is getting my external dynamic IP address. Once I have that, testing the port is no problem.
I'd really like to do this without parsing some HTML page returned by a website or router. That' s a can of worms.
Since I'm testing a port on my own system, it shouldn't get anyone upset like port scanning does.
TIA
Joe
Since Transmission already has code like that (Preferences-> Network->Test Port), I was hoping someone could tell me how it works. I probably don't know the language Transmission is written in, but I do know enough programming languages to mudde through foreign code and get a fair idea of what it's doing if I have to.
I have a notebook (kubunbtu oneiric (11.10) Linux x86) that uses dhcp, so I don't have a static IP and the IP varies depending on where the notebook is anyway.
So far, the hard part is getting my external dynamic IP address. Once I have that, testing the port is no problem.
I'd really like to do this without parsing some HTML page returned by a website or router. That' s a can of worms.
Since I'm testing a port on my own system, it shouldn't get anyone upset like port scanning does.
TIA
Joe