Re-enabled IPv6, and fixed TcpClient to work with IPv6 addresses, per feedback from #853

This commit is contained in:
Nicholas Rodine 2019-06-27 09:50:05 -04:00
parent eae4ed68c0
commit 6094bcedf5
2 changed files with 5 additions and 4 deletions

View file

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

View file

@ -89,7 +89,7 @@ namespace TLSharp.Core
exported = await SendRequestAsync<TLExportedAuthorization>(exportAuthorization);
}
var dc = dcOptions.First(d => d.Id == dcId && !d.Ipv6);
var dc = dcOptions.First(d => d.Id == dcId);
var dataCenter = new DataCenter (dcId, dc.IpAddress, dc.Port);
_transport = new TcpTransport(dc.IpAddress, dc.Port, _handler);