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
16Activity
0 of .
Results for:
No results containing your search query
P. 1
Socket Programs in Java

Socket Programs in Java

Ratings: (0)|Views: 543 |Likes:
Published by Vinaykumar Singh

More info:

Published by: Vinaykumar Singh on Mar 29, 2010
Copyright:Attribution Non-commercial

Availability:

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

11/19/2012

pdf

text

original

 
TCP
HELLO
Problem statement:-----------server side programimport java.io.*;import java.net.*; public class serverhello{Socket s; public static void main(String arg[]){try{ServerSocket ss=new ServerSocket(2500);Socket s=ss.accept();BufferedReader br=new BufferedReader(new InputStreamReader(s.getInputStream()));PrintWriter pw=new PrintWriter(new OutputStreamWriter(s.getOutputStream())); pw.println("hello client"); pw.flush();}catch(Exception e){}}}
 
-----------client side programimport java.io.*;import java.net.*; public class clienthello{public static void main(String arg[]){try{Socket s;String str; InetAddress add=InetAddress.getByName(null);s=new Socket(add,2500);BufferedReader br=new BufferedReader(new InputStreamReader(s.getInputStream()));str=br.readLine();System.out.println(str);}catch(Exception e){}}}
 
OUTPUT:-------serverCLIENT:--------client

Activity (16)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Shaveta Aggarwal liked this
prabhanatarajan liked this
Bharti Singh liked this
Roma Das liked this
Roma Das liked this
Roma Das liked this
bhagwatsachin liked this
Avinash Rooge liked this

You're Reading a Free Preview

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