Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. Public class TCP_Client
  2. {
  3. Public static void main (String[] args)
  4. {
  5. Try
  6. {
  7. InetAddress address = InetAdreess.getByName(“127.0.0.1”);
  8. Socket CliSock = new Socket(address);
  9. PrintStream outs = new PrintStream(CliSock.getOutputStream());
  10. BufferedINputStream inps = new BufferedInputStream(CliSock.getInputStream());
  11. Outs.print(“message”);
  12. Inps.write(“received data”):
  13. CliSock.Close();
  14. }
  15. Catch(Exception e)
  16. {
  17. System.out.println(“Error: “ + e);
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement