From 303849d0a94135ab3b37dec093874af73b95dd57 Mon Sep 17 00:00:00 2001 From: kitolog Date: Tue, 27 Mar 2018 12:32:38 +0300 Subject: [PATCH] Added Android open and write timeouts --- README.md | 9 +++++---- package.json | 2 +- plugin.xml | 2 +- .../cz/blocshop/socketsforcordova/SocketAdapterImpl.java | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1b752e8..1a493f8 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,8 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ## What's new -1.2.3 - fixed iOS socket closing crashes -1.5.0 - added iOS and Android open and write timeouts, changed js errors format -1.5.1 - fixed cordova js bridge implementation -1.5.2 - fixed iOS open timeout \ No newline at end of file + - 1.2.3 - fixed iOS socket closing crashes + - 1.5.0 - added iOS open and write timeouts, changed js errors format + - 1.5.1 - fixed cordova js bridge implementation + - 1.5.2 - fixed iOS open timeout + - 1.5.3 - added Android open and write timeouts \ No newline at end of file diff --git a/package.json b/package.json index 79d0bf2..f4ee98c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-socket-tcp", - "version": "1.5.2", + "version": "1.5.3", "description": "This Cordova plugin provides JavaScript API, that allows you to communicate with server through TCP protocol. Currently we support these platforms: iOS, Android, WP8.", "cordova": { "platforms": [ diff --git a/plugin.xml b/plugin.xml index 981093a..bb557ce 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,6 +1,6 @@ - + SocketsForCordova This Cordova plugin provides JavaScript API, that allows you to communicate with server through TCP protocol. diff --git a/src/android/src/cz/blocshop/socketsforcordova/SocketAdapterImpl.java b/src/android/src/cz/blocshop/socketsforcordova/SocketAdapterImpl.java index 6ff59fe..6280aa1 100644 --- a/src/android/src/cz/blocshop/socketsforcordova/SocketAdapterImpl.java +++ b/src/android/src/cz/blocshop/socketsforcordova/SocketAdapterImpl.java @@ -52,7 +52,8 @@ public class SocketAdapterImpl implements SocketAdapter { @Override public void run() { try { - socket.connect(new InetSocketAddress(host, port)); + socket.setSoTimeout(5000); + socket.connect(new InetSocketAddress(host, port), 5000); invokeOpenEventHandler(); submitReadTask(); } catch (IOException e) {