mharb 80d6e912ab Check-in Source
Signed-off-by: mharb <mharb@noreply.localhost>
2025-08-02 19:40:09 -04:00

32 lines
675 B
C#

using System;
using System.Net.Sockets;
using static System.Console;
namespace ProtosXdigitalDemo
{
internal class TcpClientConnector
{
private readonly string _ip;
private readonly int _port;
public TcpClientConnector(string ip, int port)
{
_ip = ip;
_port = port;
}
public TcpClient Connect()
{
try
{
return new TcpClient(_ip, _port);
}
catch (Exception ex)
{
WriteLine($"[Error] Unable to connect to {_ip}:{_port} → {ex.Message}");
throw;
}
}
}
}