Advertisement
TrodelHD

Untitled

May 9th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. package Connection;
  2.  
  3. import java.io.ObjectInputStream;
  4. import java.io.ObjectOutputStream;
  5.  
  6.  
  7.  
  8.  
  9. public class WaitingForMessage {
  10. ObjectInputStream OIS;
  11. ObjectOutputStream OOS;
  12.  
  13. public WaitingForMessage(ObjectInputStream ois,ObjectOutputStream oos) {
  14. Thread thread = new Thread(){
  15.  
  16. public void run(){
  17. ObjectInputStream input = ois;
  18. ObjectOutputStream output = oos;
  19. Boolean aktive = true;
  20.  
  21. while(aktive){
  22. try {
  23. byte[][] message = (byte[][])input.readObject();
  24. new InputListener(message,output);
  25. } catch (Exception e) {
  26. if(e.getMessage().equals("Connection reset")){
  27. aktive = false;
  28. this.interrupt();
  29. }
  30. }
  31. }
  32.  
  33.  
  34. }
  35.  
  36. };
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement