Initial Server & Client Commit

Started on Interfaces
- Created IManager
- Created IPacket
Started on Managers
- Created Packet Manager
Started on async client/server implementation
This commit is contained in:
PALMER
2021-12-03 15:42:14 +10:00
parent 46405a8cf4
commit 2e9a712e71
5 changed files with 139 additions and 0 deletions

46
Server.cs Normal file
View File

@ -0,0 +1,46 @@
using Articulate_Network.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace Articulate_Network
{
public class Server
{
List<IManager> managers = new List<IManager>();
TcpListener tcp;
public async Task<bool> Start(string ip, int port)
{
tcp = new TcpListener(IPAddress.Parse(ip), port);
bool connected = await Task.Run(() =>
{
try
{
tcp.Start();
return true;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return false;
}
}
);
return false;
}
public async Task<bool> SendPacket(IPacket packet)
{
return false;
}
}
}