Added Android open and write timeouts

This commit is contained in:
kitolog 2018-03-27 12:32:38 +03:00
parent 26a14948e3
commit 303849d0a9
4 changed files with 9 additions and 7 deletions

View File

@ -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. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
## What's new ## What's new
1.2.3 - fixed iOS socket closing crashes - 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.0 - added iOS open and write timeouts, changed js errors format
1.5.1 - fixed cordova js bridge implementation - 1.5.1 - fixed cordova js bridge implementation
1.5.2 - fixed iOS open timeout - 1.5.2 - fixed iOS open timeout
- 1.5.3 - added Android open and write timeouts

View File

@ -1,6 +1,6 @@
{ {
"name": "cordova-plugin-socket-tcp", "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.", "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": { "cordova": {
"platforms": [ "platforms": [

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-socket-tcp" version="1.5.2"> <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-socket-tcp" version="1.5.3">
<name>SocketsForCordova</name> <name>SocketsForCordova</name>
<description> <description>
This Cordova plugin provides JavaScript API, that allows you to communicate with server through TCP protocol. This Cordova plugin provides JavaScript API, that allows you to communicate with server through TCP protocol.

View File

@ -52,7 +52,8 @@ public class SocketAdapterImpl implements SocketAdapter {
@Override @Override
public void run() { public void run() {
try { try {
socket.connect(new InetSocketAddress(host, port)); socket.setSoTimeout(5000);
socket.connect(new InetSocketAddress(host, port), 5000);
invokeOpenEventHandler(); invokeOpenEventHandler();
submitReadTask(); submitReadTask();
} catch (IOException e) { } catch (IOException e) {