|
|
|
@ -2,7 +2,6 @@
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Net.Sockets;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace PacLib;
|
|
|
|
@ -50,7 +49,7 @@ public class PacHandler
|
|
|
|
|
_tcpListener = TcpListener.Create(_pacPort);
|
|
|
|
|
_isRunning = true;
|
|
|
|
|
_tcpListener.Start();
|
|
|
|
|
Task.Factory.StartNew(() =>
|
|
|
|
|
Task.Factory.StartNew(async () =>
|
|
|
|
|
{
|
|
|
|
|
while (_isRunning)
|
|
|
|
|
{
|
|
|
|
@ -58,12 +57,12 @@ public class PacHandler
|
|
|
|
|
{
|
|
|
|
|
if (!_tcpListener.Pending())
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(10);
|
|
|
|
|
await Task.Delay(10);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var client = _tcpListener.AcceptTcpClient();
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
await Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
var stream = client.GetStream();
|
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
|