ServerQue ;
+ int ConnectionCount = 0;
+ bool ServerActivity = false;
+ bool ServersFull = true;
+ bool StopAll = false;
+ bool stringBuildback = false;
+ bool HtmlHost = false;
+ bool Disconnect = false;
+ Server ConnectionProp ;
+ displayout dis ;
+ std::string HtmlF ;
+
+
+
+ void ServerManager ();
+ void ServerThread (int id);
+};
+
diff --git a/CrossSockets/CS_Threads.cpp b/CrossSockets/CS_Threads.cpp
new file mode 100644
index 0000000..e638944
--- /dev/null
+++ b/CrossSockets/CS_Threads.cpp
@@ -0,0 +1,37 @@
+/*_____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+ _ ____ ____ _ _ ___ _ _
+ | | / ___|_ __ ___ ___ ___/ ___| ___ ___| | _____| |_ ___ __ __/ _ \ / | | |
+ | | | | | '__/ _ \/ __/ __\___ \ / _ \ / __| |/ / _ \ __/ __| \ \ / / | | || | | |
+ | | | |___| | | (_) \__ \__ \___) | (_) | (__| < __/ |_\__ \ \ V /| |_| || | | |
+ | | \____|_| \___/|___/___/____/ \___/ \___|_|\_\___|\__|___/ \_/ \___(_)_| | |
+ |_| |_|
+ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+
+
+=========================================================
+ -Copyright (C) 2019 Neoa Software
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+=========================================================
+
+*/
+
+#pragma once
+
+// ---------------- CODE ---------------- \\
+
+#include "Base.h"
+#include "CS_Threads.h"
diff --git a/CrossSockets/CS_Threads.h b/CrossSockets/CS_Threads.h
new file mode 100644
index 0000000..979c1f4
--- /dev/null
+++ b/CrossSockets/CS_Threads.h
@@ -0,0 +1,41 @@
+/*_____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+ _ ____ ____ _ _ ___ _ _
+ | | / ___|_ __ ___ ___ ___/ ___| ___ ___| | _____| |_ ___ __ __/ _ \ / | | |
+ | | | | | '__/ _ \/ __/ __\___ \ / _ \ / __| |/ / _ \ __/ __| \ \ / / | | || | | |
+ | | | |___| | | (_) \__ \__ \___) | (_) | (__| < __/ |_\__ \ \ V /| |_| || | | |
+ | | \____|_| \___/|___/___/____/ \___/ \___|_|\_\___|\__|___/ \_/ \___(_)_| | |
+ |_| |_|
+ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+
+
+=========================================================
+ -Copyright (C) 2019 Neoa Software
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+=========================================================
+
+*/
+
+#pragma once
+
+// ---------------- CODE ---------------- \\
+
+#include "Base.h"
+
+class CS_Threads
+{
+};
+
diff --git a/CrossSockets/CrossSockets.cpp b/CrossSockets/CrossSockets.cpp
new file mode 100644
index 0000000..52736df
--- /dev/null
+++ b/CrossSockets/CrossSockets.cpp
@@ -0,0 +1,37 @@
+/*_____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+ _ ____ ____ _ _ ___ _ _
+ | | / ___|_ __ ___ ___ ___/ ___| ___ ___| | _____| |_ ___ __ __/ _ \ / | | |
+ | | | | | '__/ _ \/ __/ __\___ \ / _ \ / __| |/ / _ \ __/ __| \ \ / / | | || | | |
+ | | | |___| | | (_) \__ \__ \___) | (_) | (__| < __/ |_\__ \ \ V /| |_| || | | |
+ | | \____|_| \___/|___/___/____/ \___/ \___|_|\_\___|\__|___/ \_/ \___(_)_| | |
+ |_| |_|
+ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+
+
+=========================================================
+ -Copyright (C) 2019 Neoa Software
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+=========================================================
+
+*/
+
+#pragma once
+
+// ---------------- CODE ---------------- \\
+
+#include "Base.h"
+#include "CrossSockets.h"
diff --git a/CrossSockets/CrossSockets.h b/CrossSockets/CrossSockets.h
new file mode 100644
index 0000000..2bb82d4
--- /dev/null
+++ b/CrossSockets/CrossSockets.h
@@ -0,0 +1,41 @@
+/*_____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+ _ ____ ____ _ _ ___ _ _
+ | | / ___|_ __ ___ ___ ___/ ___| ___ ___| | _____| |_ ___ __ __/ _ \ / | | |
+ | | | | | '__/ _ \/ __/ __\___ \ / _ \ / __| |/ / _ \ __/ __| \ \ / / | | || | | |
+ | | | |___| | | (_) \__ \__ \___) | (_) | (__| < __/ |_\__ \ \ V /| |_| || | | |
+ | | \____|_| \___/|___/___/____/ \___/ \___|_|\_\___|\__|___/ \_/ \___(_)_| | |
+ |_| |_|
+ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+
+
+=========================================================
+ -Copyright (C) 2019 Neoa Software
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+=========================================================
+
+*/
+
+#pragma once
+
+// ---------------- CODE ---------------- \\
+
+#include "Base.h"
+
+class CrossSockets
+{
+};
+
diff --git a/CrossSockets/CrossSockets.vcxproj b/CrossSockets/CrossSockets.vcxproj
index fd37e8a..900358f 100644
--- a/CrossSockets/CrossSockets.vcxproj
+++ b/CrossSockets/CrossSockets.vcxproj
@@ -87,10 +87,12 @@
true
_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
+ stdcpplatest
Console
true
+ /FORCE:MULTIPLE %(AdditionalOptions)
@@ -103,6 +105,7 @@
Console
true
+ /FORCE:MULTIPLE %(AdditionalOptions)
@@ -141,12 +144,20 @@
+
+
+
+
+
+
+
+
diff --git a/CrossSockets/CrossSockets.vcxproj.filters b/CrossSockets/CrossSockets.vcxproj.filters
index 8923534..894094c 100644
--- a/CrossSockets/CrossSockets.vcxproj.filters
+++ b/CrossSockets/CrossSockets.vcxproj.filters
@@ -15,28 +15,52 @@
-
- Source Files
-
Source Files
Source Files
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
Header Files
-
- Header Files
-
Header Files
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
\ No newline at end of file
diff --git a/CrossSockets/Source.cpp b/CrossSockets/Source.cpp
index 2cbbe6e..59ef820 100644
--- a/CrossSockets/Source.cpp
+++ b/CrossSockets/Source.cpp
@@ -1,20 +1,71 @@
-#include "CPSocket.h"
+#include "CrossSockets.h"
+#include "displayout.h"
+#include "CS_COM.h"
+#include "CS_Server.h"
+#include "CS_Client.h"
//#define DISABLE_AUTH 0 /*If you want to disable the SSC */
-
+/*
int main() {
- CPSocket socket("127.0.0.1", 56040, 56000);
- //socket.StartClient();
- socket.StartServer();
+
+ CS_Server ser(80, false, true);
+ CS_Server SSS(567);
+
+
+
+
while (true) {
+ Sleep(1000);
+
+ static int i = 0;
+ i++;
+
+ std::string HoldingStr = "";
+
+ for (auto i : AllLog) {
+ HoldingStr += "" + i + "
\n";
+ }
+
+ std::string NewHtml = R"(
+
+
+
+CrossSockets v0.1
+Time in seconds : )" + std::to_string(i) + R"(
+)" + HoldingStr + R"(
+
+)";
+
+ ser.HostHtml(NewHtml);
+
+
+ //ser.SendToAll(Html);
}
+}*/
+
+int main() {
+ CS_Client cl(56012, "127.0.0.1");
+
+
+
+ while (true) {
+ sleep_for(1s);
+
+ std::string str = "VER::";
+
+
+ cl.Send(str);
- std::cout << "Sure" << std::endl;
- socket.~CPSocket();
+
+
+ }
+
+
+
}
\ No newline at end of file
diff --git a/CrossSockets/Template.h b/CrossSockets/Template.h
index 74d79b7..ff49b74 100644
--- a/CrossSockets/Template.h
+++ b/CrossSockets/Template.h
@@ -33,6 +33,8 @@ along with this program. If not, see .
// ---------------- CODE ---------------- \\
+#include "Base.h"
+
#ifndef Template
#define Template
diff --git a/CrossSockets/displayout.cpp b/CrossSockets/displayout.cpp
index 57f51ff..353134d 100644
--- a/CrossSockets/displayout.cpp
+++ b/CrossSockets/displayout.cpp
@@ -1 +1,94 @@
+/*_____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+ _ ____ ____ _ _ ___ _ _
+ | | / ___|_ __ ___ ___ ___/ ___| ___ ___| | _____| |_ ___ __ __/ _ \ / | | |
+ | | | | | '__/ _ \/ __/ __\___ \ / _ \ / __| |/ / _ \ __/ __| \ \ / / | | || | | |
+ | | | |___| | | (_) \__ \__ \___) | (_) | (__| < __/ |_\__ \ \ V /| |_| || | | |
+ | | \____|_| \___/|___/___/____/ \___/ \___|_|\_\___|\__|___/ \_/ \___(_)_| | |
+ |_| |_|
+ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
+ |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
+
+
+=========================================================
+ -Copyright (C) 2019 Neoa Software
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+=========================================================
+
+*/
+
+#pragma once
+
+// ---------------- CODE ---------------- \\
+
#include "displayout.h"
+
+
+displayout::displayout() {
+ // Init the display thread
+
+ ThreadDisplay = std::thread(&displayout::Threaded_Display, this);
+
+
+}
+
+displayout::~displayout() {
+ // Join the main thread from here
+ SetToQuit = true;
+
+ // if it takes too long for the thread to join then we can hang here
+ /// TODO fix this hang
+ while (ThreadDisplay.joinable()) {
+ ThreadDisplay.join();
+ }
+
+}
+
+void displayout::out(int enumTypeColor, std::string ToDisplay) {
+ auto ThreadPart = PreDisplayControl;
+
+ D_COLOR::ColorM::Modifier ModColor[] = { D_COLOR::defM, D_COLOR::blueM, D_COLOR::greenM, D_COLOR::redM, D_COLOR::redM, D_COLOR::magentaM, D_COLOR::yellowM };
+
+ D_COLOR::__OBJSTRING ColorBack = { ToDisplay, D_COLOR::debugstring[enumTypeColor], ModColor[enumTypeColor]};
+
+ ThreadPart.push_back(ColorBack);
+
+ PreDisplayControl = ThreadPart;
+}
+
+void displayout::Threaded_Display() {
+ // Start the init for the display thread that will be displaying all content from a thread(s)
+ while (!SetToQuit) {
+ sleep_for(66ms);
+
+ if (!__IsDisplaying) {
+ auto ThreadPart = PreDisplayControl;
+ PreDisplayControl.clear();
+
+ if (ThreadPart.size() > 0) {
+ __IsDisplaying = true;
+
+ for (auto i : ThreadPart) {
+ if (i.Message.size() > 0) {
+ std::cout << i.DebugType << "[" << i.Prompt << "]: " << i.Message << D_COLOR::defM << std::endl;
+ AllLog.push_back(i.Message);
+ }
+ }
+ __IsDisplaying = false;
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/CrossSockets/displayout.h b/CrossSockets/displayout.h
index 2615e9a..9e0003e 100644
--- a/CrossSockets/displayout.h
+++ b/CrossSockets/displayout.h
@@ -69,7 +69,62 @@ along with this program. If not, see .
#endif
std::atomic __IsDisplaying = false;
+std::vector AllLog;
+enum Debug_D
+{
+ D_DEF = 0,
+ D_LOG,
+ D_FILE,
+ D_DEBUG,
+ D_ERROR,
+ D_INFO,
+ D_WARNING,
+};
+
+namespace D_COLOR {
+ // Defines the color output for the console
+ namespace ColorM {
+ enum Code {
+ FG_RED = 31,
+ FG_GREEN = 32,
+ FG_BLUE = 34,
+ FG_YELLOW = 33,
+ FG_DEFAULT = 39,
+ FG_MAGENTA = 35,
+ BG_RED = 41,
+ BG_GREEN = 42,
+ BG_BLUE = 44,
+ BG_DEFAULT = 49
+
+ };
+ class Modifier {
+ Code code;
+ public:
+ Modifier(Code pCode) : code(pCode) {}
+ friend std::ostream&
+ operator<<(std::ostream& os, const Modifier& mod) {
+ return os << "\033[" << mod.code << "m";
+ }
+ };
+ }
+ ColorM::Modifier redM(ColorM::FG_RED);
+ ColorM::Modifier greenM(ColorM::FG_GREEN);
+ ColorM::Modifier blueM(ColorM::FG_BLUE);
+ ColorM::Modifier magentaM(ColorM::FG_MAGENTA);
+ ColorM::Modifier yellowM(ColorM::FG_YELLOW);
+ ColorM::Modifier defM(ColorM::FG_DEFAULT);
+
+ std::string debugstring[] = { "NULL", "LOG", "FILE", "DEBUG", "ERROR", "INFO", "WARNING" }; // Convert the Color to a readable displayname
+
+ typedef struct __ObjectDisplayColorString {
+ std::string Message;
+ std::string Prompt;
+
+ ColorM::Modifier DebugType;
+
+ } __OBJSTRING;
+}
class displayout
{
@@ -86,10 +141,14 @@ class displayout
#endif
protected:
-
-
+
private:
- std::atomic> PreDisplayControl;
+ std::vector PreDisplayControl;
+ std::thread ThreadDisplay;
+
+ bool SetToQuit = false;
+
+
void Threaded_Display();
};