From 3965a0f75ea72639ac532f8d5ac5affc901f28fe Mon Sep 17 00:00:00 2001 From: Marcus Cavanaugh Date: Fri, 12 Dec 2014 16:51:35 -0600 Subject: [PATCH] Notify read() when socket is closed. --- midp/socket.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/midp/socket.js b/midp/socket.js index baa9e382..b44d1aa6 100644 --- a/midp/socket.js +++ b/midp/socket.js @@ -78,6 +78,12 @@ Native.create("com/sun/midp/io/j2me/socket/Protocol.open0.([BI)V", function(ipBy reject(new JavaException("java/io/IOException", message.error)); } + this.socket.onclose = function() { + if (this.waitingData) { + this.waitingData(); + } + }.bind(this); + this.socket.ondata = (function(message) { // console.log("this.socket.ondata: " + JSON.stringify(message)); var newArray = new Uint8Array(this.data.byteLength + message.data.byteLength);