public Network() throws Exception {
        port=6740;
        while(!portChosen){
       if(checkPort(port))portChosen=true;
       else if(port<6750){port+=1;}
        }
        localAddress = (Inet4Address)Inet4Address.getLocalHost();
                
        sender = new Sender();
        receiver = new Receiver(port);
        receiver.addObserver(this);
    }