diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/record/SpectateConnection.java b/FightSystem_Main/src/de/steamwar/fightsystem/record/SpectateConnection.java index 298758e..2ccf537 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/record/SpectateConnection.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/record/SpectateConnection.java @@ -22,9 +22,7 @@ package de.steamwar.fightsystem.record; import de.steamwar.fightsystem.Config; import org.bukkit.Bukkit; -import java.io.BufferedOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; import java.net.Socket; import java.util.logging.Level; @@ -32,11 +30,15 @@ public class SpectateConnection extends Recorder{ private Socket socket; private DataOutputStream outputStream; + private PipedInputStream inputStream; SpectateConnection(){ super(); try { this.socket = new Socket(Config.spectateIP, Config.spectatePort); + socket.setSoTimeout(1); // Wait a maximum of 1ms on a blocking operation (flush) + socket.setSoLinger(true, 1); // Wait a maximum of 1ms on close + socket.setTcpNoDelay(true); // Don't wait always on ack this.outputStream = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); } catch (IOException e) { Bukkit.getLogger().log(Level.SEVERE, "Could not init connection", e);