예제 #1
0
        protected IRemoteController CreateRemoteController()
        {
            try
            {
#if NETFRAMEWORK
                var transport = new Thrift.Transport.TFramedTransport(new Thrift.Transport.TSocket("localhost", 9701));
                transport.Open();
                var protocol = new Thrift.Protocol.TBinaryProtocol(transport);
                return(new ThreadSafeRemoteController(protocol));
#else
                var rcHostAddress    = AddressUtil.GetAddressByName("localhost");
                var tSocketTransport = new Thrift.Transport.Client.TSocketTransport(rcHostAddress, 9701);
                var transport        = new Thrift.Transport.TFramedTransport(tSocketTransport);
                if (!transport.IsOpen)
                {
                    transport.OpenAsync().Wait();
                }
                var protocol = new Thrift.Protocol.TBinaryProtocol(transport);
                return(new ThreadSafeRemoteController(protocol));
#endif
            }
            catch (Exception e)
            {
                _logger.Finest("Cannot start Remote Controller", e);
                _logger.Finest(e.StackTrace);
                throw new AssertionException("Cannot start Remote Controller", e);
            }
        }
예제 #2
0
 public Address(string host, int port) : this(host, AddressUtil.GetAddressByName(host), port)
 {
 }
예제 #3
0
 public IPAddress GetInetAddress()
 {
     return(AddressUtil.GetAddressByName(GetScopedHost()));
 }