mirror of
https://github.com/donnaskiez/ac.git
synced 2024-11-21 22:24:08 +01:00
30 lines
733 B
C#
30 lines
733 B
C#
|
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();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|