TCPClient - BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream sentence = inFromUser.readLine

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

View Full Document Right Arrow Icon
import java.io.*; import java.net.*; class TCPClient { c public static void main(String argv[]) throws Exception { String sentence; String modifiedSentence; BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); Socket clientSocket = new Socket("localhost", 6789); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); sentence = inFromUser.readLine(); outToServer.writeBytes(sentence + '\n'); modifiedSentence = inFromServer.readLine(); System.out.println("from server: " + modifiedSentence); clientSocket.close(); } }...
View Full Document

This note was uploaded on 07/14/2011 for the course COP 4610L taught by Professor Staff during the Spring '09 term at University of Central Florida.

Ask a homework question - tutors are online