diff --git a/Tasks/Lab6/.vscode/launch.json b/Tasks/Lab6/.vscode/launch.json
new file mode 100644
index 0000000..d48efa3
--- /dev/null
+++ b/Tasks/Lab6/.vscode/launch.json
@@ -0,0 +1,19 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Launch ConsoleApp",
+ "type": "coreclr",
+ "request": "launch",
+ "preLaunchTask": "build ConsoleApp",
+ "program": "${workspaceFolder}/bin/Debug/net8.0/ConsoleApp.dll",
+ "args": [],
+ "cwd": "${workspaceFolder}",
+ "console": "integratedTerminal",
+ "stopAtEntry": false
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Tasks/Lab6/.vscode/tasks.json b/Tasks/Lab6/.vscode/tasks.json
new file mode 100644
index 0000000..5537c51
--- /dev/null
+++ b/Tasks/Lab6/.vscode/tasks.json
@@ -0,0 +1,17 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "build ConsoleApp",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "build",
+ "${workspaceFolder}/ConsoleApp.csproj",
+ "/property:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary;ForceNoAlign"
+ ],
+ "problemMatcher": "$msCompile"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Tasks/Lab6/ConsoleApp.csproj b/Tasks/Lab6/ConsoleApp.csproj
new file mode 100644
index 0000000..b596c9f
--- /dev/null
+++ b/Tasks/Lab6/ConsoleApp.csproj
@@ -0,0 +1,11 @@
+
+
+
+ DT6.SocketClient
+ Exe
+ net8.0
+ enable
+ disable
+
+
+
diff --git a/Tasks/Lab6/DT6_0.cs b/Tasks/Lab6/DT6_0.cs
index 4aee244..25be366 100644
--- a/Tasks/Lab6/DT6_0.cs
+++ b/Tasks/Lab6/DT6_0.cs
@@ -22,8 +22,26 @@ namespace DT6 {
public static event Action Received;
public static void StartClient() {
- /* TO BE DONE
- */
+ try
+ {
+ using TcpClient client = new("localhost", 8000);
+ using Stream stream = client.GetStream();
+ using StreamReader reader = new(client.GetStream());
+ using StreamWriter writer = new(client.GetStream());
+ {
+ string line;
+ writer.WriteLine();
+
+ while ((line = reader.ReadLine()) != null)
+ {
+ Received?.Invoke(line);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.ToString());
+ }
}
}
}
diff --git a/zhaw-dnet2.code-workspace b/zhaw-dnet2.code-workspace
index e9d7b3e..d2f65e6 100644
--- a/zhaw-dnet2.code-workspace
+++ b/zhaw-dnet2.code-workspace
@@ -9,6 +9,9 @@
},
{
"path": "./Tasks/UrlTester"
+ },
+ {
+ "path": "./Tasks/Lab6"
}
]
}