Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get host name for local machine?

10 views
Skip to first unread message

Damian Dollahite

unread,
Apr 22, 2006, 4:19:59 AM4/22/06
to
Is there an XPCOM component in the toolkit that will allow me to get the
standard host name of the local machine, similar to gethostname() in C?

--
Ryukage

James Ross

unread,
Apr 22, 2006, 6:55:14 AM4/22/06
to
Damian Dollahite wrote:
> Is there an XPCOM component in the toolkit that will allow me to get the
> standard host name of the local machine, similar to gethostname() in C?

The DNS service knows this:

http://lxr.mozilla.org/seamonkey/source/netwerk/dns/public/nsIDNSService.idl#91

For example:

var dnsComp = Components.classes["@mozilla.org/network/dns-service;1"];
var dnsSvc = dnsComp.getService(Components.interfaces.nsIDNSService);
alert(dnsSvc.myHostName);

HTH.

--
James Ross <sil...@warwickcompsoc.co.uk>
ChatZilla Developer

0 new messages