Skip to content

Commit

Permalink
socket test
Browse files Browse the repository at this point in the history
  • Loading branch information
pifopi committed Dec 18, 2023
1 parent 5172d05 commit 25687b9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions RaidCrawler.WinForms/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 25687b9

Please sign in to comment.