serverlist handler + basic crypto, rename project

This commit is contained in:
raphaeIl
2025-01-08 23:19:50 -05:00
parent f855950370
commit 55c3fc1fec
563 changed files with 278 additions and 206 deletions

View File

@@ -0,0 +1,45 @@
using Serilog;
using System.IO;
using System.Net.Sockets;
using System.Reflection;
namespace Novaria.GameServer.Protocol
{
public class Connection
{
private TcpClient tcpClient;
private BinaryReader reader;
private long sendSequence;
private int messageCount_;
private int sendingMessageCount_;
public static Connection CreateConnection(TcpClient tcpClient)
{
return new Connection(tcpClient);
}
public Connection(TcpClient tcpClient) {
this.tcpClient = tcpClient;
this.reader = new BinaryReader(new StreamReader(tcpClient.GetStream()).BaseStream);
}
public void HandleMessage(TcpClient tcpClient)
{
while (tcpClient.Connected)
{
if (tcpClient.GetStream().DataAvailable)
{
string message = reader.ReadString();
Log.Information($"Received message: {message}");
}
}
tcpClient.Close();
Log.Information("Client Disconnected!");
}
}
}