Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package connection;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import Rights.Right;
- import Var.var;
- public class WaitingForMessage {
- ObjectInputStream OIS;
- ObjectOutputStream OOS;
- Right rights = var.NORIGHTS;
- public WaitingForMessage(ObjectInputStream ois,ObjectOutputStream oos) {
- Thread thread = new Thread(){
- public void run(){
- ObjectInputStream input = ois;
- ObjectOutputStream output = oos;
- Boolean aktive = true;
- while(var.ServerIsAktive&&aktive){
- try {
- byte[][] message = (byte[][])input.readObject();
- new InputListener(message,output);
- } catch (Exception e) {
- if(e.getMessage().equals("Connection reset")){
- for(int i = 0;i<var.OutputStreams.size();i++){
- if(output.equals(var.OutputStreams.get(i))){
- var.OutputStreams.remove(i);
- }
- }
- aktive =false;
- this.interrupt();
- }
- }
- }
- }
- };
- thread.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement