mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
SimpleWebTransport: ClientConnect "IP:Port" support
This commit is contained in:
parent
10d6ffbb28
commit
0198551cc9
@ -122,7 +122,7 @@ public override bool ClientConnected()
|
||||
return client != null && client.ConnectionState != ClientState.NotConnected;
|
||||
}
|
||||
|
||||
public override void ClientConnect(string hostname)
|
||||
public override void ClientConnect(string address)
|
||||
{
|
||||
// connecting or connected
|
||||
if (ClientConnected())
|
||||
@ -131,13 +131,28 @@ public override void ClientConnect(string hostname)
|
||||
return;
|
||||
}
|
||||
|
||||
UriBuilder builder = new UriBuilder
|
||||
{
|
||||
Scheme = GetClientScheme(),
|
||||
Host = hostname,
|
||||
Port = port
|
||||
};
|
||||
UriBuilder builder;
|
||||
|
||||
// "Host:Port"
|
||||
if (Mirror.Utils.ParseHostAndPort(address, out string parsedHost, out ushort parsedPort))
|
||||
{
|
||||
builder = new UriBuilder
|
||||
{
|
||||
Scheme = GetClientScheme(),
|
||||
Host = parsedHost,
|
||||
Port = parsedPort
|
||||
};
|
||||
}
|
||||
// "Host" and default port
|
||||
else
|
||||
{
|
||||
builder = new UriBuilder
|
||||
{
|
||||
Scheme = GetClientScheme(),
|
||||
Host = address,
|
||||
Port = port
|
||||
};
|
||||
}
|
||||
|
||||
client = SimpleWebClient.Create(maxMessageSize, clientMaxMessagesPerTick, TcpConfig);
|
||||
if (client == null) { return; }
|
||||
|
Loading…
Reference in New Issue
Block a user