Category: Networking

Setting up a simple linux DNS server

yum install bind service named start sample zone file is shown below. This must be located in /etc/named $TTL 3600 ; 1 hour default TTL mydomain.com. IN SOA ns1.mydomain.com. admin.mydomain.com. ( 2006051501 ; Serial 10800 ; Refresh 600 ; Retry…

DNS server address cached in java?

We found that an old DNS address was used until we restarted the JVM. I need to review the class used to perform this activity.. Test this with a simple class. import java.net.*; public class test { static { java.security.Security.setProperty…

Unexpected end of file from server

The “java.net.SocketException: Unexpected end of file from server” exception is thrown in the HTTPClient class, as well as others. This article simply provides an example of how to generate it for testing purposes. We start with a client class that…

Simulating a connection reset in java

We start with a class that simply creates a server and a client. The server class is configured to accept a connection and then exit, forcing of course, all connections to terminate. The client class connects, then sleeps two seconds…

Simulating SocketTimeoutException

A SocketTimeoutException occurs when a socket object instance has been configured to throw the exception if it receives no data in the prescribed number of milliseconds. The default is 0, which disables the timeout. Reasons you may want to use…

Impact of socket.SO_REUSEADDR

This is often used to get around an “address already in use” error. If you know the previous server program has been shutdown, you can set this socket option prior to the initial server bind, and then restart your program.…