1 Introduction
2 Interface
get-full-hostname
get-short-hostname
3 History
4 Legal
Version: 1:0

hostname: Getting Hostname and FQDN in Racket

Neil Van Dyke

 (require (planet neil/hostname:1:0))

1 Introduction

This small package permits determining the hostname in Racket programs. It does not support multiple names, nor does it distinguish between network interfaces.
This package currently relies on the "/bin/hostname" program, available on various Unix-like systems, like GNU/Linux and Mac OS X.

2 Interface

procedure

(get-full-hostname)  (or/c #f string?)

Gets the full hostname (aka, fully-qualified domain name, or FQDN) of the host, or #f if unknown.
> (get-full-hostname)
  "computer.lan"

procedure

(get-short-hostname)  (or/c #f string?)

Gets the short hostname (i.e., just the hostname of the immediate host, not qualified with any parent domain names), or #f if unknown.
> (get-short-hostname)
  "computer"

3 History

4 Legal

Copyright 2012 Neil Van Dyke. This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See http://www.gnu.org/licenses/ for details. For other licenses and consulting, please contact the author.