Sorgente Release 1 (Codename "Campra")

This commit is contained in:
2025-09-26 08:26:15 +02:00
commit 104714fd85
88 changed files with 1205820 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace SamaPager_Client
{
internal class Client
{
internal int Port { get; set; }
internal IPAddress DestinationIP { get; set; }
internal UdpClient UdpStack { get; set; }
private IPEndPoint serverEndPoint { get; set; }
internal Client(IPAddress destinationIP, int destinationPort)
{
this.DestinationIP = destinationIP;
this.Port = destinationPort;
}
internal string StartClient()
{
serverEndPoint = new IPEndPoint(this.DestinationIP, this.Port);
try
{
UdpStack = new UdpClient();
return "Serving on " + serverEndPoint;
}
catch (Exception ex)
{
return $"Error ({ex.Message})";
}
}
internal void SendMessage(string message)
{
byte[] msgData = Encoding.UTF8.GetBytes(message);
UdpStack.Send(msgData, msgData.Length, serverEndPoint);
}
internal void KillClient()
{
this.UdpStack.Close();
}
}
}