Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
4Activity
0 of .
Results for:
No results containing your search query
P. 1
Exercise

Exercise

Ratings: (0)|Views: 61 |Likes:
Published by kumarharsh
a exercise on java networking using java.net api
a exercise on java networking using java.net api

More info:

Published by: kumarharsh on May 27, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

01/10/2013

pdf

text

original

 
import java.io.*;import java.net.*;class Client{public static void main(String args[]){Socket cs = null;try{cs = new Socket("localhost",1236);System.out.println("1");InputStream is = cs.getInputStream();System.out.println("2");InputStreamReader isr = new InputStreamReader(is);System.out.println("3");BufferedReader br = new BufferedReader(isr);System.out.println("4");String str = null;System.out.println("5");while((str=br.readLine())!=null){System.out.println(str);}System.out.println("6");}catch(IOException ioe){System.out.println(ioe);}}
 
}Server.javaimport java.io.*;import java.net.*;class Server{public static void main(String args[]){ServerSocket ss = null;Socket cs= null;try{ss = new ServerSocket(1236);cs = ss.accept(); System.out.println("Connection established");OutputStream out = cs.getOutputStream(); PrintWriter pw = new PrintWriter(out,true); for(int i=0;i<=9;i++){pw.write("Hello World");pw.flush();}}catch(IOException ioe){System.out.println(ioe);}

Activity (4)

You've already reviewed this. Edit your review.
1 hundred reads
Alex Paye liked this
Hinte liked this
ggardu liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->