Added ClientConnect(Uri uri) to KcpTransport

This commit is contained in:
MrGadget1024 2021-11-17 13:20:09 -05:00
parent a6f038f717
commit e34941267b

View File

@ -116,6 +116,14 @@ public override void ClientConnect(string address)
{
client.Connect(address, Port, NoDelay, Interval, FastResend, CongestionWindow, SendWindowSize, ReceiveWindowSize, Timeout);
}
public override void ClientConnect(Uri uri)
{
if (uri.Scheme != Scheme)
throw new ArgumentException($"Invalid url {uri}, use {Scheme}://host:port instead", nameof(uri));
int serverPort = uri.IsDefaultPort ? Port : uri.Port;
client.Connect(uri.Host, (ushort)serverPort, NoDelay, Interval, FastResend, CongestionWindow, SendWindowSize, ReceiveWindowSize, Timeout);
}
public override void ClientSend(ArraySegment<byte> segment, int channelId)
{
// switch to kcp channel.