예제 #1
0
        public async Task <bool> EstablishConnection(string ipAddress, int port = 9915)
        {
            try
            {
                connectionsDictionary.Add(ParseIpPort(ipAddress, port), _connectionFactory.GenerateConnection(ipAddress, port));
                await WorkerRepository.AddNewWorkerServer(new WorkerServerDto
                {
                    IpAddress   = ipAddress,
                    IsConnected = true,
                    Port        = port
                });

                return(true);
            }
            catch
            {
                return(false);
            }
        }