Skip to content

Commit c8a91a7

Browse files
authored
Merge pull request #542 from rehanshaukat/socket-read-timeout-fix
There is no socket read timeout set currently and default is to set t…
2 parents 822d254 + d5379c3 commit c8a91a7

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

  • org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal
  • org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/internal

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/TCPNetworkModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public void start() throws IOException, MqttException {
8080
socket = factory.createSocket();
8181
socket.connect(sockaddr, conTimeout*1000);
8282
}
83+
socket.setSoTimeout(1000);
8384
}
8485
catch (ConnectException ex) {
8586
//@TRACE 250=Failed to create TCP socket

org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/internal/TCPNetworkModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public void start() throws IOException, MqttException {
8383
socket = factory.createSocket();
8484
socket.connect(sockaddr, conTimeout*1000);
8585
}
86-
86+
socket.setSoTimeout(1000);
87+
8788
// SetTcpNoDelay was originally set ot true disabling Nagle's algorithm.
8889
// This should not be required.
8990
// socket.setTcpNoDelay(true); // TCP_NODELAY on, which means we do not use Nagle's algorithm

0 commit comments

Comments
 (0)