diff --git a/flake.nix b/flake.nix
index ca9c993..1d1c97b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -20,9 +20,13 @@
sqls
sql-studio
# Backend
- dotnetCorePackages.sdk_9_0
- dotnetCorePackages.aspnetcore_9_0
+ (dotnetCorePackages.combinePackages [
+ dotnetCorePackages.sdk_9_0
+ dotnetCorePackages.aspnetcore_9_0
+ dotnetCorePackages.sdk_8_0
+ ])
nuget
+ omnisharp-roslyn
# LSP
typescript-language-server
diff --git a/server/.csharpierrc.yaml b/server/.csharpierrc.yaml
new file mode 100644
index 0000000..3023853
--- /dev/null
+++ b/server/.csharpierrc.yaml
@@ -0,0 +1,4 @@
+printWidth: 100
+useTabs: false
+tabWidth: 2
+endOfLine: auto
diff --git a/server/.gitignore b/server/.gitignore
new file mode 100644
index 0000000..501ec83
--- /dev/null
+++ b/server/.gitignore
@@ -0,0 +1,3 @@
+obj
+bin
+
diff --git a/server/Program.cs b/server/Program.cs
new file mode 100644
index 0000000..96133a2
--- /dev/null
+++ b/server/Program.cs
@@ -0,0 +1,43 @@
+using Microsoft.OpenApi.Models;
+
+var builder = WebApplication.CreateBuilder(args);
+builder.Services.AddEndpointsApiExplorer();
+builder.Services.AddSwaggerGen(c =>
+{
+ c.SwaggerDoc("v1", new OpenApiInfo
+ {
+ Title = "FPGA Web Lab API",
+ Description = "Use FPGA in the cloud",
+ Version = "v1"
+ });
+});
+
+var app = builder.Build();
+if (app.Environment.IsDevelopment())
+{
+ app.UseSwagger();
+ app.UseSwaggerUI(c =>
+ {
+ c.SwaggerEndpoint("/swagger/v1/swagger.json", "FPAG WebLab API V1");
+ });
+}
+
+// Router
+app.MapGet("/", () => "Hello World!");
+
+var thrdStartUdpServer = new ThreadStart(UDPServer.Start);
+var thrdUdpServer = new Thread(thrdStartUdpServer);
+thrdUdpServer.Start();
+Console.WriteLine("Start UDP Server");
+var thrdStartUdpClient = new ThreadStart(UDPClient.Start);
+var thrdUdpClient = new Thread(thrdStartUdpClient);
+thrdUdpClient.Start();
+Console.WriteLine("Start UDP Client");
+
+
+thrdUdpServer.Join();
+thrdUdpClient.Join();
+
+// app.Run("http://localhost:5000");
+
+
diff --git a/server/Properties/launchSettings.json b/server/Properties/launchSettings.json
new file mode 100644
index 0000000..ceb1922
--- /dev/null
+++ b/server/Properties/launchSettings.json
@@ -0,0 +1,23 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "http://localhost:5188",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:7070;http://localhost:5188",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/server/appsettings.Development.json b/server/appsettings.Development.json
new file mode 100644
index 0000000..ff66ba6
--- /dev/null
+++ b/server/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/server/appsettings.json b/server/appsettings.json
new file mode 100644
index 0000000..4d56694
--- /dev/null
+++ b/server/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}
diff --git a/server/server.csproj b/server/server.csproj
new file mode 100644
index 0000000..a0b561d
--- /dev/null
+++ b/server/server.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net9.0
+ enable
+ enable
+
+
+
+
+
+
+
+
diff --git a/server/src/LabProtocol.cs b/server/src/LabProtocol.cs
new file mode 100644
index 0000000..e69de29
diff --git a/server/src/UdpClientPool.cs b/server/src/UdpClientPool.cs
new file mode 100644
index 0000000..bd991d3
--- /dev/null
+++ b/server/src/UdpClientPool.cs
@@ -0,0 +1,41 @@
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+
+class UDPClientPool
+{
+ private static IPAddress localhost = IPAddress.Parse("127.0.0.1");
+
+ public UDPClientPool()
+ {
+
+ }
+
+ public static void SendLocalHost(int port, string[] stringArray)
+ {
+ Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
+
+ byte[] sendbuf = Encoding.ASCII.GetBytes(stringArray[0]);
+ IPEndPoint ep = new IPEndPoint(localhost, port);
+
+ socket.SendTo(sendbuf, ep);
+ }
+
+ public static void CycleSendLocalHost(int times, int sleepMilliSeconds, int port, string[] stringArray)
+ {
+ Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
+ byte[] sendbuf = Encoding.ASCII.GetBytes(stringArray[0]);
+ IPEndPoint ep = new IPEndPoint(localhost, port);
+
+ while (times-- >= 0)
+ {
+ socket.SendTo(sendbuf, ep);
+
+ Thread.Sleep(sleepMilliSeconds);
+ }
+ }
+
+ public void Start()
+ {
+ }
+}
diff --git a/server/src/UdpServer.cs b/server/src/UdpServer.cs
new file mode 100644
index 0000000..8181fe9
--- /dev/null
+++ b/server/src/UdpServer.cs
@@ -0,0 +1,63 @@
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+
+public class UDPServer
+{
+ private int listenPort;
+ private UdpClient listener;
+ private IPEndPoint groupEP;
+ private Thread thrd;
+ private bool isRunning;
+
+
+
+ public UDPServer(int port)
+ {
+ // Construction
+ listenPort = port;
+ listener = new UdpClient(listenPort);
+ groupEP = new IPEndPoint(IPAddress.Any, listenPort);
+
+ // New Thread
+ var thrdStart = new ThreadStart(ReceiveHandler);
+ thrd = new Thread(thrdStart);
+ }
+
+ private void ReceiveHandler()
+ {
+ try
+ {
+ while (isRunning)
+ {
+ byte[] bytes = listener.Receive(ref groupEP);
+
+ Console.WriteLine($"Received broadcast from {groupEP} :");
+ Console.WriteLine($" {Encoding.ASCII.GetString(bytes, 0, bytes.Length)}");
+ }
+ }
+ catch (SocketException e)
+ {
+ Console.WriteLine(e);
+ }
+ finally
+ {
+ listener.Close();
+ }
+ }
+
+ public void Start()
+ {
+ isRunning = true;
+ thrd.Start();
+ }
+
+ public void Stop()
+ {
+ isRunning = false;
+ thrd.Join();
+ }
+
+
+}
+
diff --git a/src/App.vue b/src/App.vue
index 7cb5f1e..6898241 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,8 +1,7 @@