mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Added read timeout.
This commit is contained in:
@@ -34,7 +34,7 @@ import java.net.SocketAddress;
|
|||||||
|
|
||||||
public class GuacamoleTCPClient extends GuacamoleClient {
|
public class GuacamoleTCPClient extends GuacamoleClient {
|
||||||
|
|
||||||
private static final int SOCKET_TIMEOUT = 5000;
|
private static final int SOCKET_TIMEOUT = 15000;
|
||||||
|
|
||||||
private Socket sock;
|
private Socket sock;
|
||||||
private Reader input;
|
private Reader input;
|
||||||
@@ -54,6 +54,9 @@ public class GuacamoleTCPClient extends GuacamoleClient {
|
|||||||
sock = new Socket();
|
sock = new Socket();
|
||||||
sock.connect(address, SOCKET_TIMEOUT);
|
sock.connect(address, SOCKET_TIMEOUT);
|
||||||
|
|
||||||
|
// Set read timeout
|
||||||
|
sock.setSoTimeout(SOCKET_TIMEOUT);
|
||||||
|
|
||||||
// On successful connect, retrieve I/O streams
|
// On successful connect, retrieve I/O streams
|
||||||
input = new InputStreamReader(sock.getInputStream());
|
input = new InputStreamReader(sock.getInputStream());
|
||||||
output = new OutputStreamWriter(sock.getOutputStream());
|
output = new OutputStreamWriter(sock.getOutputStream());
|
||||||
|
Reference in New Issue
Block a user