online/offline status

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I'm trying to develop a program in C# that will change 'label1' in my
form to "online" if a server is present on 127.0.0.1:8080 and "offline"
if it is not.

I was playing around with this:
public static bool UrlIsValid(string smtpHost)
{
bool br = false;
try
{
IPHostEntry ipHost = Dns.Resolve(smtpHost);
br = true;
}
catch (SocketException se)
{
MessageBox.Show (se.Message);
br = false;
}
return br;
}

but that only resolves the hostname.. hence it always returns "offline"
does anyone have a better way of doing this? if there was a 'ping'
command that would probably solve this, but i would need some way to
test the ping return, see where i'm going, this has me quite confused.
Any Help would be appreciated.

~ Kotori

.



Relevant Pages

  • resolver problem with Opera
    ... Opera correctly resolves the hostname using /etc/hosts. ... a tcsh binary from a -stable system and used that to ping the host ... packets transmitted, 3 packets received, 0% packet loss ...
    (freebsd-current)
  • Re: Strange problem with linux samba
    ... > When I ping -c1 silvermountain ... hostname resolution is performed through standard ... services that talk to a DNS server. ... will talk to DNS to look for a DNS ...
    (comp.protocols.smb)
  • Perplexing Ultra 60 networking issue
    ... address was bound to the on-board 100 basetT Ethernet port, hme0. ... The plan is to migrate to using rge0, ... hostname in it, just in case, and added the new IP ... On another machine, I run ping -s 192.168.0.5, which should send a steady stream ...
    (comp.unix.solaris)
  • Re: Need help on a strange dns client issue
    ... Networking, Internet, Routing, VPN Troubleshooting on http://www.ChicagoTech.net ... but it can ping the same computer by IP address. ... When pinging by hostname, I get the "Unknown host" message. ... If I stop the DNS Client service however, I can ping the host by ...
    (microsoft.public.windows.server.networking)
  • Re: dig fails but ping works
    ... of a name until one resolves or until it runs out of variations. ... but that should show up with dig or host. ... % ping notl337.net. ...
    (comp.os.linux.networking)