6 Replies - 52314 Views - Last Post: 09 January 2014 - 07:51 AM

#1 JDoggChris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-September 08

I need a port that is always open whenever my computer is on

Posted 08 February 2012 - 07:30 PM

If this is in the wrong place I'm sorry. I've started a little project which at the moment is just a fancy looking page with green online text or red offline text

/* Utorrent */
$ip = "ip";

$port = "port";

if (! $sock = @fsockopen($ip, $port, $num, $error, 5))

echo '<font color="red"><b>Offline</b></font>';

else{

echo '<font color="green"><b>Online</b></font>';

fclose($sock);

} 

?>

I'm using it to detect if certain things on my pc are online, VNC FTP etc etc, and I'm trying to think of a way to detect if my PC is actually ON. I thought of cheating and using an existing port (say the VNC port) but it's possible that VNC could crash and be offline while the computer is still on, is there an easier way to do this or should I continue using the VNC port?

Is This A Good Question/Topic? 0
  • +

Replies To: I need a port that is always open whenever my computer is on

#2 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5468
  • View blog
  • Posts: 11,749
  • Joined: 02-June 10

Re: I need a port that is always open whenever my computer is on

Posted 09 February 2012 - 09:21 AM

Quote

I'm trying to think of a way to detect if my PC is actually ON


Ping it
Was This Post Helpful? 1
  • +
  • -

#3 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5234
  • View blog
  • Posts: 27,024
  • Joined: 10-May 07

Re: I need a port that is always open whenever my computer is on

Posted 19 February 2012 - 07:09 AM

You could write a simple socket in C (or your preferred language) & bind it to whatever port you want. A ping will verify that the network card is on & listening for packet requests. But if you want to verify that the OS is functional, you could delete & create a flag file every minute, 10 minutes, half hour, hour, how ever often you wish to check, & then write a client/server socket program to relay the time/date stamp.

You could also use a piece of software such as nagios which is a web-based program that provides graphical charts & is more-or-less a glorified ping tool.

It serves many, many other network monitoring functions, but it's original purpose is what you describe here. Monitoring & logging.
Was This Post Helpful? 0
  • +
  • -

#4 RyanRahl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 26-March 12

Re: I need a port that is always open whenever my computer is on

Posted 06 April 2012 - 02:49 PM

If I were in your position and I wanted to know if my remote machine was on but didn't want to rely on a piece of software running to accomplish it I would simply set my firewall to "REJECT" packets on a firewalled port instead of "DROP"

This way you could use something like nmap to determine if your machine is on by:

nmap -sS [Remote IP] -p[random port]

and if the result comes back as "closed" then the firewall has rejected the packet and sent back a packet with the "RST" flag. If it's sending packets, the machine is on.

and if the result comes back as "filtered" then your machine is off because it will have sent back no packets (unless your firewall is configured to "DROP" then nmap will have no way of knowing if the machine is off or if the firewall is set to "DROP")
Was This Post Helpful? 0
  • +
  • -

#5 trh51  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 20-May 12

Re: I need a port that is always open whenever my computer is on

Posted 23 May 2012 - 06:23 PM

Try this. It has a nice GUI interface. If your still looking around try seeing if you can use a batch file to get the job done!

Sorry forgot the link! Here: LINK. Its not mine. I found it on a google search for you!
Was This Post Helpful? 0
  • +
  • -

#6 mariamincey64  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-January 14

Re: I need a port that is always open whenever my computer is on

Posted 09 January 2014 - 12:45 AM

Hello JDoggChris

sory i can't help u
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9059
  • View blog
  • Posts: 34,017
  • Joined: 12-June 08

Re: I need a port that is always open whenever my computer is on

Posted 09 January 2014 - 07:51 AM

@mariamincey64 - please do not necro old threads.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1