From 25687b9716c93fb2e7b712a301e39dd5e5b63801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DOTTEL=20Ga=C3=ABl?= Date: Fri, 17 Nov 2023 22:51:59 +0100 Subject: [PATCH] socket test --- RaidCrawler.WinForms/MainWindow.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/RaidCrawler.WinForms/MainWindow.cs b/RaidCrawler.WinForms/MainWindow.cs index b52ae3f..f80fae1 100644 --- a/RaidCrawler.WinForms/MainWindow.cs +++ b/RaidCrawler.WinForms/MainWindow.cs @@ -7,6 +7,8 @@ using RaidCrawler.WinForms.SubForms; using SysBot.Base; using System.Diagnostics; +using System.Net; +using System.Net.Sockets; using System.Text.Json; using static RaidCrawler.Core.Structures.Offsets; @@ -62,6 +64,8 @@ public partial class MainWindow : Form private bool StopAdvances => !Config.EnableFilters || RaidFilters.Count == 0 || RaidFilters.All(x => !x.Enabled); + Thread backgroundThread; + public MainWindow() { Config = new ClientConfig(); @@ -137,6 +141,25 @@ public MainWindow() USB_Port_TB.Visible = false; USB_Port_label.Visible = false; } + + backgroundThread = new Thread(async () => + { + TcpListener server = new TcpListener(IPAddress.Parse("127.0.0.1"), 18069); + server.Start(); + TcpClient client = await server.AcceptTcpClientAsync(); + NetworkStream stream = client.GetStream(); + BinaryReader reader = new BinaryReader(stream); + BinaryWriter writer = new BinaryWriter(stream); + + while (true) + { + int inData = reader.ReadInt32(); + int outData = inData * 2; + writer.Write(outData); + writer.Flush(); + } + }); + backgroundThread.Start(); } private void UpdateStatus(string status)