What im trying to do is to create a client and server system similar to the whois protocol.

What i have is a server program that has a database of peoples locations. Then the client can query the server by giving it a users username and it will respond with there location.

Ive not really used any of java's networking features before doing this so i appologise if any of my questions are trivial.

I have the client program working as it should, but im haveing problems with the server.

Here is a bit of the code i have:
Code:
	public static void run() throws Exception
	{
		int port = 43;

		try 
		{
			ServerSocket acceptSocket;
			acceptSocket = new ServerSocket(port) ;
			while (true) 
			{
				Socket s = acceptSocket.accept() ;
				host = s.getInetAddress().getHostName();
				doRequest(s);
				s.close();
			}
		} 
		catch (IOException e) 
		{
			System.out.println("run Method Error: " + e.toString());
		}
	}
That is what waits for the connections on port 43, that again seems to work ok.

This next bit of code however keeps throwing java.net.SocketException's:
Code:
	// reads the request from the stream
	public static void readRequest(Socket s) throws Exception
	{
		int c;

		System.out.println("Doing request");


		InputStream in = s.getInputStream();
		try
		{

			while ((c = in.read()) != -1) 
			{
				System.out.print((char) c);
				request = request + (char)c;
			}
			in.close();

		}
		catch (IOException e)
		{
			System.out.println("readRequest Error: " + e.toString());
		}

	}
The full exception is: java.net.SocketException: Connection reset by peer: JVM_
recv in socket input stream read

The data from the client is being received correctly, so why is this error being generated?

Thanks in advance,

Adam.