MXServer version 0.0 beta

Description:
Mail messages aren't always sent to the host mentioned at the email address.
But sometimes messages must be sent to a completely different domain.
All of this is regulated by the DNS (Domain Name System, RFC 1039)
DNS is the system that translates host names to an IP address.

The MX records at a DNS system define where message for a particular domain should be sent.
Querying a DNS server directly from Java or other languages isn't that easy.
Then you must construct your own UDP packages.
Most likely for Java there are other solutions like the JavaMail API.
But often it's a difficult task.

This Java application calls the dig program to find MX records.
Dig is most likely is a UNIX Linux thing.
So I don't think you can directly install this application on a Windows server.
(Sorry Bill that doesn't work.)

This application server accepts hostnames and returns a list of MX records.
It uses a simple TCP/IP socket for it.
That's all it does.

Here is an example:

$ telnet alpha.comweb.nl 6048
Trying 212.204.205.91...
Connected to alpha.comweb.nl.
Escape character is '^]'.

MXServer beta 0.0 here
Please give host name to lookup
sun.com
MX records :
sun.com. 4H IN MX 40 mars.sun.com.
sun.com. 4H IN MX 40 mondzo.sun.com.
sun.com. 4H IN MX 5 venus.sun.com.
sun.com. 4H IN MX 5 lukla.sun.com.
sun.com. 4H IN MX 5 saturn.sun.com.
sun.com. 4H IN MX 5 patan.sun.com.
sun.com. 4H IN MX 15 mercury.sun.com.

Connection closed by foreign host.

As you can see its plain simple.
With a little tweak the server can be configured to listen only at localhost.

Copyright & disclaimer:
This software is freeware, just a small contribution to the Internet community.
Contribution and suggestions on this application is always welcome.
A link to this document is appreciated.
The use of this software is at your own risk.

Source code:
The source code is included.
It's a simple Java ServerSocket with a backlog.
It handles one connection at a time but several connections can be waiting before processed.
A separate Thread periodically checks for a deadlock and should free it if needed.
According to the java documentation that might occur on some OS systems.
It is related to the STDOUT buffer size of the application.

There are probably some lines at the source code that you need to tweak a little.
Probably only the location of the dig program should be changed.

DOWNLOAD
http://www.comweb.nl/java/MXServer/MXServer.zip

Contact:
If you need any more help just email me
rvdb@comweb.nl