void turnOnTurretReceiver() throws IOException { Global.log("Turning on turret receiver..."); while (true) { if (isDisposed()) throw new IOException("Client game disposed"); Global.log("Connecting to port " + Global.turretPort() + "..."); try { turretStream = new ClientByteStream(ip, Global.turretPort(), Ship.bufferSize()); break; } catch (IOException ex) { } } Global.log("Connected!"); timers.add( new FixedTimer( new FixedTask() { public boolean fixedRate() { return false; } public float FPS() { return Global.ReceiveFPS; } public void run() { byte[] data = null; String name = null; try { data = turretStream.read(); name = turretStream.readLine(); } catch (IOException ex) { System.err.println("Cannot read info from turret stream"); Global.onException(); stop(); return; } if (data == null) return; Ship s = new Ship(name, Global.transparent); s.setDesign(new Design.Turret(s)); s.fromBytes(data, false); addShip(s); } })); }