mirror-ac/server/Server.cs

30 lines
733 B
C#
Raw Normal View History

2023-09-02 15:47:15 +02:00
using System.Net;
using System.Net.Sockets;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using server;
namespace server
{
public class Server
{
private IPEndPoint _ipEndPoint;
private TcpListener _tcpListener;
public Server()
{
_ipEndPoint = new IPEndPoint(IPAddress.Any, 8888);
_tcpListener = new TcpListener(_ipEndPoint);
}
public async Task Listen()
{
_tcpListener.Start();
using TcpClient _client = await _tcpListener.AcceptTcpClientAsync();
Thread dispatchThread = new Thread(() => new Dispatch(_client, _client.GetStream()));
dispatchThread.Start();
}
}
}