Engine-Pong/Game/Network/NetworkClient.cs

22 lines
552 B
C#
Raw Normal View History

2024-02-01 23:38:35 +03:00
using LiteNetLib;
2024-02-02 12:04:53 +03:00
namespace Pong.Network;
2024-02-01 23:38:35 +03:00
public class NetworkClient
{
public readonly EventBasedNetListener Listener = null!;
public readonly NetManager Client = null!;
public NetworkClient()
{
Listener = new EventBasedNetListener();
Client = new NetManager(Listener);
}
public void Connect(string address, int port, string? password = null)
=> Client.Connect(address, port, password ?? string.Empty);
public void PollEvents() => Client.PollEvents();
public void Stop() => Client.Stop();
}