29 lines
733 B
C#
29 lines
733 B
C#
namespace Syntriax.Engine.Network;
|
|
|
|
public interface INetworkCommunicator
|
|
{
|
|
event OnPacketReceivedDelegate? OnPacketReceived;
|
|
|
|
void Stop();
|
|
|
|
delegate void OnPacketReceivedDelegate(INetworkCommunicator sender, object packet, string from);
|
|
}
|
|
|
|
public interface INetworkCommunicatorClient : INetworkCommunicator
|
|
{
|
|
void Connect(string address, int port, string? password = null);
|
|
|
|
void SendToServer(INetworkPacket packet);
|
|
}
|
|
|
|
public interface INetworkCommunicatorServer : INetworkCommunicator
|
|
{
|
|
string Password { get; }
|
|
int MaxConnectionCount { get; }
|
|
int Port { get; }
|
|
|
|
void Start(int port, int maxConnectionCount, string? password = null);
|
|
|
|
void SendToClient(string to, INetworkPacket packet);
|
|
}
|