Aluizio,
One thing that I know that changed in JDK1.2 is the security model. Just
about any access to a resource (ie files, sockets, etc.) must be explicitly
enabled in the Java policy file (jdk1.2/jre/lib/security/java.policy). This is
documented under the JDK1.2/docs/guide/security/*.html. The error message
"Couldn't get I/O for the connection to .." is coming from your code where you
catch IOException. If you add something like:
System.err.println( "IOException: ", e.getMessage() );
e.printStackTrace() ;
Then, you will get more information about why the socket connection failed.
In particular it will tell you if any permissions are lacking, and then you can
grant them in your java.policy file.
HTH,
-Gary
Aluizio Arcela <[EMAIL PROTECTED]> on 04/12/99 05:49:51 PM
To: [EMAIL PROTECTED]
cc: (bcc: Gary Moss/arl)
Subject: [java3d] Sockets and Java3D
We are writing a distributed application for a sound & image
experiment where a client computer is to be connected to both a
graphical server and to a MIDI server. We are trying to write
the graphical service by using Java 3D in its immediate mode.
But we have faced to the following basic problem: the program's
connection segment which was running OK in JDK1.1 fails if the
program is compiled with JDK1.2. Even the code available in the
documentation fails as described below.
The example in the section "Reading and Writing to a Socket" of
the Java tutorial
(which is found at the address:
http://java.sun.com/docs/books/tutorial/networking/sockets/readingWriting.html
)
runs OK when compiled with Symantec Visual Cafe 2.5, but the same
is not true when the example is compiled with JDK1.2. In this case
the connection is not successful, according to the output "Couldn't
get I/O for the connection to: 164.41.14.70".
Is there any problem with sockets in JDK1.2? Are we missing any detail?
Thanks in advance.
Aluizio Arcela
Multimedia Computing Lab
University of Brasilia
--------------------------------------------
import java.io.*;
import java.net.*;
public class EchoClient {
public static void main(String[] args) throws IOException
{
Socket echoSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
echoSocket = new Socket("164.41.14.70", 2000);
out = new
PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new
InputStreamReader(echoSocket.getInputStream()));
System.err.println("Connected to 164.41.14.70");
} catch (UnknownHostException e) {
System.err.println("Don't know about host:
164.41.14.70.");
System.exit(1);
} catch (IOException e) {
System.err.println("Couldn't get I/O for the
connection to: 164.41.14.70.");
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(new
InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("echo: " + in.readLine());
}
out.close();
in.close();
stdIn.close();
echoSocket.close();
}
}
------------
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/