mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00: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;
|
return client != null && client.ConnectionState != ClientState.NotConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ClientConnect(string hostname)
|
public override void ClientConnect(string address)
|
||||||
{
|
{
|
||||||
// connecting or connected
|
// connecting or connected
|
||||||
if (ClientConnected())
|
if (ClientConnected())
|
||||||
@ -131,13 +131,28 @@ public override void ClientConnect(string hostname)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UriBuilder builder = new UriBuilder
|
UriBuilder builder;
|
||||||
{
|
|
||||||
Scheme = GetClientScheme(),
|
|
||||||
Host = hostname,
|
|
||||||
Port = port
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// "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);
|
client = SimpleWebClient.Create(maxMessageSize, clientMaxMessagesPerTick, TcpConfig);
|
||||||
if (client == null) { return; }
|
if (client == null) { return; }
|
||||||
|
Loading…
Reference in New Issue
Block a user