Meum/Meum.Client/Client.cs
2024-10-22 13:16:20 +05:00

29 lines
786 B
C#

global using System;
global using System.Collections.Generic;
global using System.Threading;
global using System.Threading.Tasks;
global using Meum.Core;
using System.Net;
namespace Meum.Client;
public class Client
{
private readonly HashSet<ServerConnection> _connectedServers = new();
public IReadOnlySet<ServerConnection> ConnectedServers => _connectedServers;
public UserAddress Address { get; }
public Client(UserAddress address)
{
Address = address;
}
public async Task<ServerConnection> ConnectToServerAsync(DnsEndPoint serverEndPoint)
{
var serv = new ServerConnection(serverEndPoint);
await serv.ConnectAsync();
_connectedServers.Add(serv);
return serv;
}
}