Advertisement
Guest User

client

a guest
Nov 12th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import java.io.DataInputStream;
  2. import java.io.DataOutputStream;
  3. import java.net.Socket;
  4.  
  5. public class client {
  6. public static void main(String[] args) {
  7. try(Socket s = new Socket("localhost", 1234)) {
  8. DataInputStream in = new DataInputStream(s.getInputStream());
  9. DataOutputStream out = new DataOutputStream(s.getOutputStream());
  10.  
  11. //System.out.println("sup server!");
  12.  
  13. out.writeUTF("sup server66");
  14.  
  15. String m = in.readUTF();
  16. System.out.println(m);
  17.  
  18. in.close();
  19. out.close();
  20. s.close();
  21. }catch (Exception e) {
  22. e.printStackTrace();
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement