import java.net.*;
import java.io.*;
public class client{
public static void main(String a[]){
try{
Socket w=new Socket("localhost",1234);
DataOutputStream o=new DataOutputStream(w.getOutputStream());
o.writeUTF("where are you");
DataInputStream i=new DataInputStream(w.getInputStream());
String sr=new String(i.readUTF());
System.out.println(sr);
o.close();
i.close();
w.close();
}
catch(UnknownHostException u){
System.out.println("message"+u);
}
catch(IOException i){
System.out.println("message"+i);
}
}
}
Programming can be fun, and so can cryptography; however, they should not be combined. :p
Search
java socket (Client part)
Subscribe to:
Post Comments (Atom)
Java Interfaces vs. Abstract class
Summary of the similarities and differences between the Interfaces and Abstract class Abstract class Interface Has a constructor Yes No An i...
No comments:
Post a Comment