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:
46
Server.cs
Normal file
46
Server.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user