Java Reference
In-Depth Information
fDataClient.println ("IO Exception while
reading data");
break;
}
}
// Ask for data after every fTimeUpdate long period.
try {
Thread.sleep (fDataClient.fTimeUpdate);
}
catch (InterruptedException e) {}
}
if (fServer ! = null) closeServer ();
fDataClient.println ( " disconnected " );
fDataClient.setDisconnected ();
} // run
/** Set up the streams with the server and then login. **/
boolean doConnection () throws IOException {
// Get the input and output streams from the socket
InputStream in = fServer.getInputStream ();
// Use the reader for obtaining text
fNetInputReader = new BufferedReader (
new InputStreamReader (in));
// User the DataInputStream for getting numerical
// values.
fNetInputDataStream = new DataInputStream (in);
// Output stream for sending messages to the server.
fNetOutputDataStream = fServer.getOutputStream ();
// Write with a PrintWriter for sending text to the
// server.
fPrintWriter = new PrintWriter (
new OutputStreamWriter (fNetOutputDataStream,
" 8859 - 1 " ), true);
// Now try the login procedure.
if (!login ())
return false;
return true;
 
Search WWH ::




Custom Search