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/

Reply via email to