Change Connect method

This commit is contained in:
Sofia 2020-08-05 20:45:34 +03:00
parent d26ed426cf
commit ada3f4bafd

View File

@ -50,9 +50,11 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
MessageListener.Message($"Started listening to {endpoint}");
}
public void Connect(string address, int port, byte protocolIdent) {
public void Connect(string address, int port, byte protocolIdent, bool startListening = true) {
if (startListening) {
IPEndPoint listenEndpoint = (IPEndPoint)UdpClient.Client.LocalEndPoint;
StartListen(listenEndpoint);
}
IPEndPoint endpoint = new IPEndPoint(FindAddress(address), port);
ConnectionManager.StartConnection(endpoint, protocolIdent);
MessageListener.Message($"Connecting to {endpoint}");