diff --git a/src/wp8/src/SocketAdapter.cs b/src/wp8/src/SocketAdapter.cs index 83892ea..07d353c 100644 --- a/src/wp8/src/SocketAdapter.cs +++ b/src/wp8/src/SocketAdapter.cs @@ -12,6 +12,7 @@ namespace Blocshop.ScoketsForCordova { Task Connect(String host, int port); Task Write(byte[] data); + void ShutdownWrite(); void Close(); SocketAdapterOptions Options { set; } Action DataConsumer { set; } @@ -55,11 +56,16 @@ namespace Blocshop.ScoketsForCordova await this.socket.SendTaskAsync(socketAsyncEventArgs); } - public void Close() + public void ShutdownWrite() { this.socket.Shutdown(SocketShutdown.Send); } + public void Close() + { + this.socket.Close(); + } + private void StartReadTask() { Task.Factory.StartNew(() => this.RunRead()); diff --git a/src/wp8/src/SocketPlugin.cs b/src/wp8/src/SocketPlugin.cs index cced065..c73d13e 100644 --- a/src/wp8/src/SocketPlugin.cs +++ b/src/wp8/src/SocketPlugin.cs @@ -58,11 +58,13 @@ namespace Blocshop.ScoketsForCordova } catch (SocketException ex) { + this.ErrorHandler(socketKey, ex); this.DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, ex.Message)); socketStorage.Remove(socketKey); } catch (AggregateException ex) { + this.ErrorHandler(socketKey, ex.InnerException); this.DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, ex.InnerException.Message)); socketStorage.Remove(socketKey); } @@ -87,6 +89,15 @@ namespace Blocshop.ScoketsForCordova } } + public void shutdownWrite(string parameters) + { + string socketKey = JsonHelper.Deserialize(parameters)[0]; + + ISocketAdapter socket = this.socketStorage.Get(socketKey); + + socket.ShutdownWrite(); + } + public void close(string parameters) { string socketKey = JsonHelper.Deserialize(parameters)[0];