GetHostAddresses() public static method

public static GetHostAddresses ( string hostNameOrAddress ) : System.Net.IPAddress[]
hostNameOrAddress string
return System.Net.IPAddress[]
Ejemplo n.º 1
0
        private void EstablishConnect()
        {
            Receive <Connect>(_ =>
            {
                IPAddress ip;
                if (!IPAddress.TryParse(_host, out ip))
                {
                    ip = Dns.GetHostAddresses(_host).First();
                }

                var endPoint = new IPEndPoint(ip, _port);
                _listener.Tell(new Connecting(_host.ToString(), _port));
                Context.System.Tcp().Tell(new Tcp.Connect(endPoint, timeout: _connectionTimeout));
            });

            Receive <Tcp.Connected>(c =>
            {
                _currentConnection = new CurrentConnection(Sender);
                _currentConnection.Socket.Tell(new Tcp.Register(Self, useResumeWriting: false));
                var greatingMessageTimer = Context.System.Scheduler.ScheduleTellOnceCancelable(_connectionTimeout, Self,
                                                                                               ReceiveTimeout.Instance, Self);

                Become(() => WaitingGreating(greatingMessageTimer));
            });
        }