Modified TcpClient setup to work with IPv6 addresses, fixing #773.

This commit is contained in:
Nicholas Rodine 2019-06-27 09:50:05 -04:00 committed by Andres G. Aragoneses
parent 6ce4eceaca
commit 3224113e4c

View file

@ -16,10 +16,11 @@ namespace TLSharp.Core.Network
{ {
if (handler == null) if (handler == null)
{ {
_tcpClient = new TcpClient();
var ipAddress = IPAddress.Parse(address); var ipAddress = IPAddress.Parse(address);
_tcpClient.Connect(ipAddress, port); var endpoint = new IPEndPoint(ipAddress, port);
_tcpClient = new TcpClient(endpoint);
_tcpClient.Connect(endpoint);
} }
else else
_tcpClient = handler(address, port); _tcpClient = handler(address, port);