Screen Capture

This is the home page of the Java program HostEntry. It runs on any computer that supports Java Swing. HostEntry was developed on Linux 2.2 using Java 1.3.0 from Sun.

HostEntry is a graphical program for querying any Domain Name Server directly (a little like nslookup). Eventually, you will have complete control over your DNS queries. For now though, the GUI will only lookup "A" records (standard lookup) and "PTR" records (reverse lookups) depending on the format of the string you enter into the "Lookup" text field. If the text is a dotted quad, the GUI does a reverse lookup; otherwise, the GUI does a standard lookup. For most users these two lookups are all you need.

One frustating thing with Java is that it does not (to my knowledge) provide a standard method for discerning the user's domain name server. For now, you will have to type in your domain name server you want to use. Note that you are not stuck with using just that server. Play around with the name servers that are returned in the "Authority" resource records, and see how this affects the "AA" ("Authoritative Answer") flag.

HostEntry grew out of some frustrations with the standard Unix library calls gethostbyname() and gethostbyaddr() which are not reentrant. I played around with using multiple processes and IPC to get around the reentrancy problems. I even wrote a similar GUI using FLTK, but at the end of the day, I decided it would be better to just write my own -- reentrant -- resolver. As I am in the middle of re-learning Java, I decided to write the resolver in Java which also gives me a good opportunity to upgrade HostConvert.

HostEntry gets its name from the same Unix library calls that are not reentrant. They return a "hostent" structure.

HostEntry does in fact open a connection with the user's name server of choice, issue its query directly to the server, and decodes the result. It does not currently continue iterative searches to completion, nor does it deal in UDP datagrams. All connections are via TCP virtual circuits. Also missing is notification via the GUI of socket-level errors. These are currently printed on stderr. If you have a reliable internet connection, you should have no problems using this program.

Until I decided how I want to display the output, I am showing the entire reply from the DNS. You will primarily be interested in the lines that start with "answer[xxx] = ". These are the direct answers to the query that was submitted. If you are doing a standard lookup that maps domain names to IP address, your answer will be preceded by the code "A" (for "Address"). If you submitted a reverse lookup, your answer is preceded by the code "PTR" (for "PoinTeR"). You will also want to look at the "RCODE:" field in the "flags =" section. This is the return code from the server. Failures will be noted here.


  • If you see an error message that states, "Error: Expecting TCP count," resubmit your query. This error happens infrequently. I'm still looking for the cause.
  • There is currently no way to cancel a lookup. So, I've added a tab panel to let you start another query while you wait for the current one to finish. In the finished version, there will be a cancel button and the tab panel will shrink and grow dynamically.
  • The HostEntry Distribution