public static void DerivativeClient_can_connect_and_terminate_without_error_forceIpv4(bool forceIpv4)
        {
            // Arrange
            SocketClient.ForceIpv4 = forceIpv4;

            // Act
            IQFeedLauncher.Start();

            var client = DerivativeClientFactory.CreateNew();

            client.Connect();
            client.Disconnect();

            IQFeedLauncher.Terminate();

            // Assert
            Assert.Pass($"IQFeedLauncher and the derivative client were able to connect and disconnect/terminate without error with the 'SocketClient.ForceIpv4' value set to '{forceIpv4}'.");
        }
Esempio n. 2
0
        /// <summary>
        /// Connects to IQFeed.
        /// </summary>
        /// <param name="host">The IQFeed host to connect to.</param>
        /// <param name="port">The IQFeed port to connect to.</param>
        public override async Task Connect(
            string host, int port, CancellationToken token = default)
        {
            IPEndPoint ipEndPoint;

            try
            {
                ipEndPoint = new IPEndPoint(IPAddress.Parse(host), port);
            }

            // If we are given a domain, perform a DNS lookup to find the host
            catch (FormatException)
            {
                var ip = await GetIpAddress(host, token);

                ipEndPoint = new IPEndPoint(ip, port);
            }

            client = DerivativeClientFactory.CreateNew(ipEndPoint.Address.ToString(), port);

            await client.ConnectAsync();
        }
Esempio n. 3
0
 public void SetUp()
 {
     _derivativeClient = DerivativeClientFactory.CreateNew();
     _derivativeClient.Connect();
 }