From c7d53cf5af6d3c04799e835cc0fe4f4a20adad3c Mon Sep 17 00:00:00 2001 From: Dylan Holshausen Date: Tue, 15 Nov 2022 17:53:40 +0200 Subject: [PATCH 1/6] Added Linux Standalone to Assembly Definition --- Runtime/com.ccadori.sandsocketunity.Runtime.asmdef | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Runtime/com.ccadori.sandsocketunity.Runtime.asmdef b/Runtime/com.ccadori.sandsocketunity.Runtime.asmdef index fe24108..bc2fa93 100644 --- a/Runtime/com.ccadori.sandsocketunity.Runtime.asmdef +++ b/Runtime/com.ccadori.sandsocketunity.Runtime.asmdef @@ -8,7 +8,8 @@ "WSA", "WindowsStandalone32", "WindowsStandalone64", - "XboxOne" + "XboxOne", + "LinuxStandalone64" ], "excludePlatforms": [], "allowUnsafeCode": false, @@ -18,4 +19,4 @@ "defineConstraints": [], "versionDefines": [], "noEngineReferences": false -} \ No newline at end of file +} From 22d177f3ed09ea2b778de466c69e6315ffd680c3 Mon Sep 17 00:00:00 2001 From: Dylan Holshausen Date: Wed, 16 Nov 2022 15:04:11 +0200 Subject: [PATCH 2/6] Added Disconnect to Client Class --- Runtime/Client.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Runtime/Client.cs b/Runtime/Client.cs index 0e6ac4e..18d607d 100644 --- a/Runtime/Client.cs +++ b/Runtime/Client.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.Sockets; using System.Collections.Generic; using System.Collections; @@ -70,6 +70,25 @@ public void Connect() } } + public void Disconnect() + { + try + { + if (clientReceiveThread != null) + clientReceiveThread.Abort(); + + if (socketConnection != null) + socketConnection.Close(); + + if (queueReadingRoutine != null) + StopCoroutine(queueReadingRoutine); + } + catch (Exception ex) + { + Debug.LogError("Disconnecting Client Failed."); + } + } + private IEnumerator ReadingQueuedMessages() { while (true) From f8fb971388dbc74d56057afc8c8c06c3ff3f2c47 Mon Sep 17 00:00:00 2001 From: Dylan Holshausen Date: Wed, 23 Nov 2022 17:38:56 +0200 Subject: [PATCH 3/6] Changed order of events in Disconnect() --- Runtime/Client.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Runtime/Client.cs b/Runtime/Client.cs index 18d607d..ebb9248 100644 --- a/Runtime/Client.cs +++ b/Runtime/Client.cs @@ -71,23 +71,23 @@ public void Connect() } public void Disconnect() - { + { try { + if (queueReadingRoutine != null) + StopCoroutine(queueReadingRoutine); + if (clientReceiveThread != null) clientReceiveThread.Abort(); if (socketConnection != null) socketConnection.Close(); - - if (queueReadingRoutine != null) - StopCoroutine(queueReadingRoutine); } catch (Exception ex) - { + { Debug.LogError("Disconnecting Client Failed."); - } - } + } + } private IEnumerator ReadingQueuedMessages() { From 6a93026ec06334dade5a3a742e7e7ff47d6fa6ac Mon Sep 17 00:00:00 2001 From: Dylan Holshausen Date: Wed, 23 Nov 2022 17:39:14 +0200 Subject: [PATCH 4/6] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f992d37..ef55162 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.ccadori.sandsocketunity", - "version": "1.0.1", + "version": "1.0.2", "displayName": "Sand Socket Unity", "unity": "2019.3", "keywords": [ From 05601eaa912cbf5ea06a3d6ff6c449d94a2b081c Mon Sep 17 00:00:00 2001 From: Dylan Holshausen Date: Fri, 20 Jan 2023 13:31:42 +0200 Subject: [PATCH 5/6] Update Client.cs --- Runtime/Client.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Runtime/Client.cs b/Runtime/Client.cs index ebb9248..12e81f0 100644 --- a/Runtime/Client.cs +++ b/Runtime/Client.cs @@ -10,6 +10,7 @@ using System.Security.Cryptography.X509Certificates; using System.Security.Authentication; using System.IO; +using UnityEngine.Events; namespace Sand { @@ -36,6 +37,7 @@ public class Client : MonoBehaviour public bool useTLS = false; public bool leaveInnerStreamOpen = false; public bool validateCert = true; + public UnityEvent sandReadingException = new UnityEvent(); private string eventDelimiter = "#e#"; private string packetDelimiter = "\n"; @@ -71,7 +73,7 @@ public void Connect() } public void Disconnect() - { + { try { if (queueReadingRoutine != null) @@ -84,10 +86,10 @@ public void Disconnect() socketConnection.Close(); } catch (Exception ex) - { - Debug.LogError("Disconnecting Client Failed."); - } - } + { + Debug.LogError("Disconnecting Client Failed."); + } + } private IEnumerator ReadingQueuedMessages() { @@ -131,9 +133,10 @@ private void Reading() } } } - catch (SocketException socketException) - { - Debug.LogError("Socket exception: " + socketException); + catch(Exception e) + { + Debug.LogError("Sand Reading Exception"); + sandReadingException.Invoke(); } } From 5973d3cf850a7728ba20d2d867c65c3270100248 Mon Sep 17 00:00:00 2001 From: Dylan Holshausen Date: Fri, 20 Jan 2023 13:32:12 +0200 Subject: [PATCH 6/6] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef55162..c5e8397 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.ccadori.sandsocketunity", - "version": "1.0.2", + "version": "1.0.3", "displayName": "Sand Socket Unity", "unity": "2019.3", "keywords": [