feat: added revised version of the old networking system
This commit is contained in:
28
Shared/Network/Abstract/INetworkCommunicator.cs
Normal file
28
Shared/Network/Abstract/INetworkCommunicator.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user