1
This commit is contained in:
@@ -9,6 +9,7 @@ using Timer = System.Timers.Timer;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
@@ -117,6 +118,18 @@ namespace BITKit.Net
|
||||
|
||||
public async UniTask<bool> Connect(string address = "127.0.0.1", ushort port = 27014)
|
||||
{
|
||||
//如果address是域名,解析为Ip
|
||||
if (address.Contains("."))
|
||||
{
|
||||
var ip = await Dns.GetHostAddressesAsync(address);
|
||||
if (ip.Length > 0)
|
||||
{
|
||||
address = ip[0].ToString();
|
||||
BIT4Log.Log<KcpNetClient>($"解析域名:{address}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (IsConnecting)
|
||||
{
|
||||
BIT4Log.Warning<KcpNetClient>("正在连接中");
|
||||
|
Reference in New Issue
Block a user