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...
-
import java.net.*; import java.io.*; public class client{ public static void main(String a[]){ try{ Socket w=new Socket("localhost...
-
Elements are processed in the First In First Out (FIFO) manner Those Queues that are present in the util package are known as Unbounded Qu...
-
package datastructures.linear ; public class TreeFromTheScratch { public static void main (String[] args) { TreeImpl tree = ne...
No comments:
Post a Comment