Sockets

alice dubois alice.dubois at lemel.fr
Tue Nov 24 07:43:07 PST 1998


Hi,

I'm trying to run the following program with kaffe but an IOException is 
caught.
The responce is:
"1
 2
 catch IOException
 java.io.IOException"

If I run it with jdk_1.1.6 the result is correct:
"1
 2 
 3
 It is ... "

Is there something to add to make it working with kaffe ?


import java.net.*;
import java.io.*;

public class daytimeClient {

  public static void main(String[] args) {

    Socket theSocket;
    String hostname;
    DataInputStream theTimeStream;
	String theTime;

    if (args.length > 0) {
      hostname = args[0];
    }
    else {
      hostname = "localhost";
    }

    try {
      theSocket = new Socket(hostname, 21);
	System.out.println("1 ");
      theTimeStream = new DataInputStream(theSocket.getInputStream());
	System.out.println("2 ");	
      theTime = theTimeStream.readLine();                   
	System.out.println("3 ");	
      System.out.println("It is " + theTime + " at " + hostname);
    }  // end try
    catch (UnknownHostException e) {
	System.out.println(" catch UnknownHostException ");
      System.err.println(e);
    }
    catch (IOException e) {
	System.out.println(" catch IOException ");
      System.err.println(e);
    }

  }  // end main

} // end daytimeClient


Thanks for your help.

Alice


More information about the kaffe mailing list