Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Public class TCP_Server
  2. {
  3. Public static void main(String[] args)
  4. {
  5. String data_array[][] = new String [6][2];
  6. Socket ServSock = null;
  7. Try
  8. {
  9. ServSock = new Socket (“1045”);
  10. While(true)
  11. {
  12. Socket CliSock = ServSock.accept();
  13. BufferedInputStream inps = new BufferedInputStream(CliSock.getInputStream());
  14. InputStreamReader isr = new InputStreamReader(inps, “US-ASCII”);
  15. //decode by country with isr.read();
  16. BufferedOutputStream outs = new BufferedOuputStream(CliSock.getOutputStream());
  17. OuputStreamWriter osw = new OutputStreamWriter(outs, “US-ASCII”);
  18. Osw.write(result, 0, result.length);
  19. }
  20. }
  21. Catch(Exception e)
  22. {
  23. System.out.println(“Error: “ + e);
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement