diff --git a/Class Examples/tcpClient/.vs/tcpClient/v15/.suo b/Class Examples/tcpClient/.vs/tcpClient/v15/.suo new file mode 100644 index 0000000..b6f8b6d Binary files /dev/null and b/Class Examples/tcpClient/.vs/tcpClient/v15/.suo differ diff --git a/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/db.lock b/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide b/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide new file mode 100644 index 0000000..56758a8 Binary files /dev/null and b/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide differ diff --git a/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide-shm b/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide-shm new file mode 100644 index 0000000..4b16156 Binary files /dev/null and b/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide-shm differ diff --git a/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide-wal b/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide-wal new file mode 100644 index 0000000..bea30c1 Binary files /dev/null and b/Class Examples/tcpClient/.vs/tcpClient/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Class Examples/tcpClient/tcpClient.sln b/Class Examples/tcpClient/tcpClient.sln new file mode 100644 index 0000000..e56ccc1 --- /dev/null +++ b/Class Examples/tcpClient/tcpClient.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2042 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tcpClient", "tcpClient\tcpClient.csproj", "{CF1C7E4C-7AE2-450B-9D91-83E4385BAB05}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CF1C7E4C-7AE2-450B-9D91-83E4385BAB05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF1C7E4C-7AE2-450B-9D91-83E4385BAB05}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF1C7E4C-7AE2-450B-9D91-83E4385BAB05}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF1C7E4C-7AE2-450B-9D91-83E4385BAB05}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3D22DFE5-33F6-45C3-A787-822F1F2E180C} + EndGlobalSection +EndGlobal diff --git a/Class Examples/tcpClient/tcpClient/App.config b/Class Examples/tcpClient/tcpClient/App.config new file mode 100644 index 0000000..00bfd11 --- /dev/null +++ b/Class Examples/tcpClient/tcpClient/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Class Examples/tcpClient/tcpClient/Program.cs b/Class Examples/tcpClient/tcpClient/Program.cs new file mode 100644 index 0000000..105c318 --- /dev/null +++ b/Class Examples/tcpClient/tcpClient/Program.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net; +using System.Net.Sockets; +using System.Threading; + +namespace tcpClient +{ + class Program + { + static void ReadData(object socket) + { + TcpClient client = (TcpClient)socket; + while (true) + { + byte[] buffer = new byte[1024]; + int k = client.GetStream().Read(buffer, 0, buffer.Length); + Console.WriteLine("Received from server {0}", Encoding.ASCII.GetString(buffer, 0, k)); + } + } + static void Main(string[] args) + { + TcpClient client = new TcpClient(); + client.Connect(IPAddress.Loopback, 5000); + Thread t = new Thread(ReadData); + t.Start(client); + while (true) + { + Console.WriteLine("Please input a string to send"); + string input = Console.ReadLine(); + byte[] msg = Encoding.ASCII.GetBytes(input); + client.GetStream().Write(msg, 0, msg.Length); + } + } + } +} diff --git a/Class Examples/tcpClient/tcpClient/Properties/AssemblyInfo.cs b/Class Examples/tcpClient/tcpClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..47674fd --- /dev/null +++ b/Class Examples/tcpClient/tcpClient/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("tcpClient")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("tcpClient")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("cf1c7e4c-7ae2-450b-9d91-83e4385bab05")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.exe b/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.exe new file mode 100644 index 0000000..aede20e Binary files /dev/null and b/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.exe differ diff --git a/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.exe.config b/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.exe.config new file mode 100644 index 0000000..00bfd11 --- /dev/null +++ b/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.pdb b/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.pdb new file mode 100644 index 0000000..76b52d5 Binary files /dev/null and b/Class Examples/tcpClient/tcpClient/bin/Debug/tcpClient.pdb differ diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Class Examples/tcpClient/tcpClient/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..ec177e1 Binary files /dev/null and b/Class Examples/tcpClient/tcpClient/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Class Examples/tcpClient/tcpClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Class Examples/tcpClient/tcpClient/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Class Examples/tcpClient/tcpClient/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csproj.CoreCompileInputs.cache b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..5ecf993 --- /dev/null +++ b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +c321ffaed7fbac401adb57c7786a8739651417cc diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csproj.FileListAbsolute.txt b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..167618b --- /dev/null +++ b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +c:\users\cod_user\source\repos\tcpClient\tcpClient\bin\Debug\tcpClient.exe.config +c:\users\cod_user\source\repos\tcpClient\tcpClient\bin\Debug\tcpClient.exe +c:\users\cod_user\source\repos\tcpClient\tcpClient\bin\Debug\tcpClient.pdb +c:\users\cod_user\source\repos\tcpClient\tcpClient\obj\Debug\tcpClient.csprojAssemblyReference.cache +c:\users\cod_user\source\repos\tcpClient\tcpClient\obj\Debug\tcpClient.csproj.CoreCompileInputs.cache +c:\users\cod_user\source\repos\tcpClient\tcpClient\obj\Debug\tcpClient.exe +c:\users\cod_user\source\repos\tcpClient\tcpClient\obj\Debug\tcpClient.pdb diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csprojAssemblyReference.cache b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csprojAssemblyReference.cache new file mode 100644 index 0000000..3bb0d79 Binary files /dev/null and b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.csprojAssemblyReference.cache differ diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.exe b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.exe new file mode 100644 index 0000000..aede20e Binary files /dev/null and b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.exe differ diff --git a/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.pdb b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.pdb new file mode 100644 index 0000000..76b52d5 Binary files /dev/null and b/Class Examples/tcpClient/tcpClient/obj/Debug/tcpClient.pdb differ diff --git a/Class Examples/tcpClient/tcpClient/tcpClient.csproj b/Class Examples/tcpClient/tcpClient/tcpClient.csproj new file mode 100644 index 0000000..b6eb4ec --- /dev/null +++ b/Class Examples/tcpClient/tcpClient/tcpClient.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {CF1C7E4C-7AE2-450B-9D91-83E4385BAB05} + Exe + tcpClient + tcpClient + v4.6.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/.suo b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/.suo new file mode 100644 index 0000000..c828468 Binary files /dev/null and b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/.suo differ diff --git a/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/db.lock b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide new file mode 100644 index 0000000..56758a8 Binary files /dev/null and b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide differ diff --git a/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide-shm b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide-shm new file mode 100644 index 0000000..2d16e03 Binary files /dev/null and b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide-shm differ diff --git a/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide-wal b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide-wal new file mode 100644 index 0000000..297eec2 Binary files /dev/null and b/Class Examples/tcpMultiConnections/.vs/tcpMultiConnections/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections.sln b/Class Examples/tcpMultiConnections/tcpMultiConnections.sln new file mode 100644 index 0000000..828a289 --- /dev/null +++ b/Class Examples/tcpMultiConnections/tcpMultiConnections.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2042 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tcpMultiConnections", "tcpMultiConnections\tcpMultiConnections.csproj", "{D3074096-207B-407E-9E7C-A042DE604D2C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D3074096-207B-407E-9E7C-A042DE604D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3074096-207B-407E-9E7C-A042DE604D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3074096-207B-407E-9E7C-A042DE604D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3074096-207B-407E-9E7C-A042DE604D2C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {21DC9900-C2B0-46BD-8674-11900BE1A55F} + EndGlobalSection +EndGlobal diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/App.config b/Class Examples/tcpMultiConnections/tcpMultiConnections/App.config new file mode 100644 index 0000000..00bfd11 --- /dev/null +++ b/Class Examples/tcpMultiConnections/tcpMultiConnections/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/Program.cs b/Class Examples/tcpMultiConnections/tcpMultiConnections/Program.cs new file mode 100644 index 0000000..a1c7831 --- /dev/null +++ b/Class Examples/tcpMultiConnections/tcpMultiConnections/Program.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net; +using System.Net.Sockets; +using System.Threading; + +namespace tcpMultiConnections +{ + class Program + { + //static List sockets = new List(); + static Dictionary sockets = new Dictionary(); + static void Main(string[] args) + { + TcpListener server = new TcpListener(IPAddress.Loopback, 5000); + server.Start(); + + Console.WriteLine("Waiting for a connection..."); + while(true) + { + Thread t = new Thread(handleConnections); + Socket client = server.AcceptSocket(); + t.Start(client); + } + + server.Stop(); + } + + static void handleConnections(object socket) + { + Socket client = (Socket)socket; + + Console.WriteLine($"Connection accepted from {client.RemoteEndPoint}"); + byte[] buffer = new byte[1024]; + int k = client.Receive(buffer); + string username = Encoding.ASCII.GetString(buffer, 0, k); + sockets[username] = client; + while (true) + { + try + { + k = client.Receive(buffer); + foreach (KeyValuePair otherClient in sockets) + { + if (otherClient.Value != client) + { + string clientData = $"[{username}] - " + Encoding.ASCII.GetString(buffer, 0, k); + otherClient.Value.Send(Encoding.ASCII.GetBytes(clientData)); + } + //otherClient.Value.Send(buffer, 0, k, SocketFlags.None); + } + Console.WriteLine("Data received from client: {0}", Encoding.ASCII.GetString(buffer, 0, k)); + } catch (Exception e) + { + sockets.Remove(username); + break; + } + //client.Send(Encoding.ASCII.GetBytes("Received!")); + } + client.Close(); + } + } +} diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/Properties/AssemblyInfo.cs b/Class Examples/tcpMultiConnections/tcpMultiConnections/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8efcbc1 --- /dev/null +++ b/Class Examples/tcpMultiConnections/tcpMultiConnections/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("tcpMultiConnections")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("tcpMultiConnections")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d3074096-207b-407e-9e7c-a042de604d2c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.exe b/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.exe new file mode 100644 index 0000000..744017d Binary files /dev/null and b/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.exe differ diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.exe.config b/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.exe.config new file mode 100644 index 0000000..00bfd11 --- /dev/null +++ b/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.pdb b/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.pdb new file mode 100644 index 0000000..b80ef8f Binary files /dev/null and b/Class Examples/tcpMultiConnections/tcpMultiConnections/bin/Debug/tcpMultiConnections.pdb differ diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..5e14ba3 Binary files /dev/null and b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csproj.CoreCompileInputs.cache b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..5ecf993 --- /dev/null +++ b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +c321ffaed7fbac401adb57c7786a8739651417cc diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csproj.FileListAbsolute.txt b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..ec13bd1 --- /dev/null +++ b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +c:\users\cod_user\source\repos\tcpMultiConnections\tcpMultiConnections\bin\Debug\tcpMultiConnections.exe.config +c:\users\cod_user\source\repos\tcpMultiConnections\tcpMultiConnections\bin\Debug\tcpMultiConnections.exe +c:\users\cod_user\source\repos\tcpMultiConnections\tcpMultiConnections\bin\Debug\tcpMultiConnections.pdb +c:\users\cod_user\source\repos\tcpMultiConnections\tcpMultiConnections\obj\Debug\tcpMultiConnections.csprojAssemblyReference.cache +c:\users\cod_user\source\repos\tcpMultiConnections\tcpMultiConnections\obj\Debug\tcpMultiConnections.csproj.CoreCompileInputs.cache +c:\users\cod_user\source\repos\tcpMultiConnections\tcpMultiConnections\obj\Debug\tcpMultiConnections.exe +c:\users\cod_user\source\repos\tcpMultiConnections\tcpMultiConnections\obj\Debug\tcpMultiConnections.pdb diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csprojAssemblyReference.cache b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csprojAssemblyReference.cache new file mode 100644 index 0000000..3bb0d79 Binary files /dev/null and b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.csprojAssemblyReference.cache differ diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.exe b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.exe new file mode 100644 index 0000000..744017d Binary files /dev/null and b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.exe differ diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.pdb b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.pdb new file mode 100644 index 0000000..b80ef8f Binary files /dev/null and b/Class Examples/tcpMultiConnections/tcpMultiConnections/obj/Debug/tcpMultiConnections.pdb differ diff --git a/Class Examples/tcpMultiConnections/tcpMultiConnections/tcpMultiConnections.csproj b/Class Examples/tcpMultiConnections/tcpMultiConnections/tcpMultiConnections.csproj new file mode 100644 index 0000000..d4354b5 --- /dev/null +++ b/Class Examples/tcpMultiConnections/tcpMultiConnections/tcpMultiConnections.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {D3074096-207B-407E-9E7C-A042DE604D2C} + Exe + tcpMultiConnections + tcpMultiConnections + v4.6.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Class Examples/tcpServer/.vs/tcpServer/v15/.suo b/Class Examples/tcpServer/.vs/tcpServer/v15/.suo new file mode 100644 index 0000000..c42585f Binary files /dev/null and b/Class Examples/tcpServer/.vs/tcpServer/v15/.suo differ diff --git a/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/db.lock b/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide b/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide new file mode 100644 index 0000000..56758a8 Binary files /dev/null and b/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide differ diff --git a/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide-shm b/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide-shm new file mode 100644 index 0000000..c145ebb Binary files /dev/null and b/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide-shm differ diff --git a/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide-wal b/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide-wal new file mode 100644 index 0000000..eb907c9 Binary files /dev/null and b/Class Examples/tcpServer/.vs/tcpServer/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Class Examples/tcpServer/tcpServer.sln b/Class Examples/tcpServer/tcpServer.sln new file mode 100644 index 0000000..bb837c3 --- /dev/null +++ b/Class Examples/tcpServer/tcpServer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2042 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tcpServer", "tcpServer\tcpServer.csproj", "{F17E0160-D0E1-45A4-B11E-A4FBCAFBF46B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F17E0160-D0E1-45A4-B11E-A4FBCAFBF46B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F17E0160-D0E1-45A4-B11E-A4FBCAFBF46B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F17E0160-D0E1-45A4-B11E-A4FBCAFBF46B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F17E0160-D0E1-45A4-B11E-A4FBCAFBF46B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {63F9EA77-B0BD-4C44-8302-F80FB6B9B5AC} + EndGlobalSection +EndGlobal diff --git a/Class Examples/tcpServer/tcpServer/App.config b/Class Examples/tcpServer/tcpServer/App.config new file mode 100644 index 0000000..00bfd11 --- /dev/null +++ b/Class Examples/tcpServer/tcpServer/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Class Examples/tcpServer/tcpServer/Program.cs b/Class Examples/tcpServer/tcpServer/Program.cs new file mode 100644 index 0000000..cd62de6 --- /dev/null +++ b/Class Examples/tcpServer/tcpServer/Program.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Threading; +using System.Net; +using System.Net.Sockets; + +namespace tcpServer +{ + class Program + { + static void Main(string[] args) + { + try + { + TcpListener server = new TcpListener(IPAddress.Loopback, 5000); + server.Start(); + + Socket client = server.AcceptSocket(); + Console.WriteLine($"Connection accepted from {client.RemoteEndPoint}"); + + byte[] buffer = new byte[1024]; + int k = client.Receive(buffer); + Console.WriteLine(Encoding.ASCII.GetString(buffer, 0, k)); + client.Send(Encoding.ASCII.GetBytes("Message received!")); + //client.NoDelay = true; + client.Close(); + server.Stop(); + } catch (Exception e) + { + Console.WriteLine(e); + } + } + } +} diff --git a/Class Examples/tcpServer/tcpServer/Properties/AssemblyInfo.cs b/Class Examples/tcpServer/tcpServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9837fe1 --- /dev/null +++ b/Class Examples/tcpServer/tcpServer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("tcpServer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("tcpServer")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f17e0160-d0e1-45a4-b11e-a4fbcafbf46b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.exe b/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.exe new file mode 100644 index 0000000..955af31 Binary files /dev/null and b/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.exe differ diff --git a/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.exe.config b/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.exe.config new file mode 100644 index 0000000..00bfd11 --- /dev/null +++ b/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.pdb b/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.pdb new file mode 100644 index 0000000..f297067 Binary files /dev/null and b/Class Examples/tcpServer/tcpServer/bin/Debug/tcpServer.pdb differ diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Class Examples/tcpServer/tcpServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..27dc9da Binary files /dev/null and b/Class Examples/tcpServer/tcpServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Class Examples/tcpServer/tcpServer/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Class Examples/tcpServer/tcpServer/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Class Examples/tcpServer/tcpServer/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csproj.CoreCompileInputs.cache b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..5ecf993 --- /dev/null +++ b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +c321ffaed7fbac401adb57c7786a8739651417cc diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csproj.FileListAbsolute.txt b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..c79ea1d --- /dev/null +++ b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +C:\Users\COD_User\source\repos\tcpServer\tcpServer\bin\Debug\tcpServer.exe.config +C:\Users\COD_User\source\repos\tcpServer\tcpServer\bin\Debug\tcpServer.exe +C:\Users\COD_User\source\repos\tcpServer\tcpServer\bin\Debug\tcpServer.pdb +C:\Users\COD_User\source\repos\tcpServer\tcpServer\obj\Debug\tcpServer.csprojAssemblyReference.cache +C:\Users\COD_User\source\repos\tcpServer\tcpServer\obj\Debug\tcpServer.csproj.CoreCompileInputs.cache +C:\Users\COD_User\source\repos\tcpServer\tcpServer\obj\Debug\tcpServer.exe +C:\Users\COD_User\source\repos\tcpServer\tcpServer\obj\Debug\tcpServer.pdb diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csprojAssemblyReference.cache b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csprojAssemblyReference.cache new file mode 100644 index 0000000..3bb0d79 Binary files /dev/null and b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.csprojAssemblyReference.cache differ diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.exe b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.exe new file mode 100644 index 0000000..955af31 Binary files /dev/null and b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.exe differ diff --git a/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.pdb b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.pdb new file mode 100644 index 0000000..f297067 Binary files /dev/null and b/Class Examples/tcpServer/tcpServer/obj/Debug/tcpServer.pdb differ diff --git a/Class Examples/tcpServer/tcpServer/tcpServer.csproj b/Class Examples/tcpServer/tcpServer/tcpServer.csproj new file mode 100644 index 0000000..58bb2b4 --- /dev/null +++ b/Class Examples/tcpServer/tcpServer/tcpServer.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {F17E0160-D0E1-45A4-B11E-A4FBCAFBF46B} + Exe + tcpServer + tcpServer + v4.6.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file