PPT Slide
public class EchoClient {
public static void main(String[] args) throws IOException {
Socket echoSocket = null;
BufferedReader in = null;
echoSocket = new Socket("taranis", 7);
out = new PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println ("Don't know about host: taranis.");
} catch (IOException e) {
System.err.println("Couldn't get I/O for "
+ "the connection to: taranis.");
Source: http://www.javasoft.com