Skip to content

Commit

Permalink
socket test
Browse files Browse the repository at this point in the history
  • Loading branch information
pifopi committed Dec 5, 2023
1 parent 48b7978 commit 7ae7343
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions RaidCrawler.WinForms/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
using SysBot.Base;
using System.Data;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Text.Json;
using static RaidCrawler.Core.Structures.Offsets;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace RaidCrawler.WinForms
{
Expand Down Expand Up @@ -63,6 +67,8 @@ public partial class MainWindow : Form
private bool StopAdvances =>
!Config.EnableFilters || RaidFilters.Count == 0 || RaidFilters.All(x => !x.Enabled);

Thread backgroundThread;

public MainWindow()
{
string build = string.Empty;
Expand Down Expand Up @@ -133,6 +139,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 7ae7343

Please sign in to comment.