Client - InputStreamReader( socket.getInputStream() ) );...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.*; import java.io.*; import java.net.*; public class Client { public static void main( String [] arg ) throws Exception { Socket socket; BufferedReader stdIn; BufferedReader fromServer; PrintWriter toServer; String s; String result; socket = new Socket( arg[0], 3000 ); stdIn = new BufferedReader( new InputStreamReader( System.in ) ); fromServer = new BufferedReader( new
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: InputStreamReader( socket.getInputStream() ) ); toServer = new PrintWriter( new OutputStreamWriter( socket.getOutputStream() ), true ); while ( (s = stdIn.readLine()) != null ) { toServer.println( s ); result = fromServer.readLine(); System.out.println( "reverse: " + result ); } socket.close(); } }...
View Full Document

This note was uploaded on 12/16/2010 for the course CS 352 taught by Professor Staff during the Spring '06 term at Rutgers.

Ask a homework question - tutors are online