From 1cd22bb16a4a0a340b7b44ee5cb0368448f17522 Mon Sep 17 00:00:00 2001 From: Brett Anthony Date: Mon, 16 Oct 2017 23:27:58 -0600 Subject: [PATCH] bool Connected() Updated Added a ping to Connected() so that it may return the current value regardless of if other data is being sent. --- HLAEServer/AssemblyInfo.cpp | 2 +- HLAEServer/HLAE_Client.cpp | 11 +++++++++++ HLAEServer/HLAE_Client.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/HLAEServer/AssemblyInfo.cpp b/HLAEServer/AssemblyInfo.cpp index e706ede..14ee70e 100644 --- a/HLAEServer/AssemblyInfo.cpp +++ b/HLAEServer/AssemblyInfo.cpp @@ -21,7 +21,7 @@ using namespace System::Security::Permissions; [assembly:AssemblyCultureAttribute(L"")]; -[assembly:AssemblyVersionAttribute("1.0.0.1")]; +[assembly:AssemblyVersionAttribute("1.0.0.2")]; [assembly:ComVisible(false)]; diff --git a/HLAEServer/HLAE_Client.cpp b/HLAEServer/HLAE_Client.cpp index e1a12af..cb5c693 100644 --- a/HLAEServer/HLAE_Client.cpp +++ b/HLAEServer/HLAE_Client.cpp @@ -44,9 +44,20 @@ namespace HLAEServer inline bool HLAE_WS_Client::Connected() { + SendPing(); // We'll ping the server to update Connected. return m_socket->Connected; } + void HLAE_WS_Client::SendPing() + { + int Code = 0b10001001; + array^ Payload = gcnew array(2); + Payload[0] = (Byte)Code; + Payload[1] = 0; // Mask = 0, Payload Length = 0. + + SendData(Payload); + } + void HLAE_WS_Client::ReadDataWS() { diff --git a/HLAEServer/HLAE_Client.h b/HLAEServer/HLAE_Client.h index 595f3e2..fc2eb4c 100644 --- a/HLAEServer/HLAE_Client.h +++ b/HLAEServer/HLAE_Client.h @@ -51,6 +51,7 @@ namespace HLAEServer int StartAfter(array^ data, String^ key); void DoHandShake(array^ data); void SendData(array^ data); + void SendPing(); float FourByteFloatLE(array^ data, int offset); UInt32 FourByteUInt32LE(array^ data, int offset); UInt16 TwoByteUInt16BE(array^ data, int offset);