1 Reply Latest reply on Oct 15, 2015 8:53 AM by hyunkook RSS
    hyunkook Explorer

    C# SteamSensorClient Sample Test Error  (Code 1001)?

    C# SteamSensorClient Sample Test Error

     

    I do not know why the connection error

    Make sure that any problems with the following code:

     


     

    var config = new ClientConfigurator();

     

                // The uri for connecting to Thingworx
                config.Uri = "[http://10.10.10.110/Thingworx | http://10.10.10.110/Thingworx]";

     

                // Reconnect every 15 seconds if a disconnect occurs or if initial connection cannot be made
                config.ReconnectInterval = 1;

     

               // Credentials Example

     


                SecurityClaims claims = new SecurityClaims();
                claims.addClaim(RESTAPIConstants.PARAM_APPKEY, "df7cd577-39f1-48c3-a00d-81e1ad22c14d");

     

               // claims.addClaim(RESTAPIConstants.PARAM_USERID, "frontis02");

     


               // claims.addClaim(RESTAPIConstants.PARAM_PASSWORD, "frontis02");

     


     


                // Set the security using an Application Key
                var appKey = "df7cd577-39f1-48c3-a00d-81e1ad22c14d";
               // var claims = SecurityClaims.fromAppKey(appKey);
                config.Claims = claims;

     


     

                // Set the name of the client
                config.Name = "SteamSensorGateway";

     

                // Get the scan rate (milliseconds) that is specific to this example
                // The example will execute the processScanRequest of the VirtualThing
                // based on this scan rate
                int scanRate = Int32.Parse("1");

     

                // Create the client passing in the configuration from above
                SteamSensorClient client = new SteamSensorClient(config);
                try
                {
                    // Create two Virtual Things
                    SteamThing sensor1 = new SteamThing("Temperature", "1st Floor Steam Sensor", "Temperature", client);
                    SteamThing sensor2 = new SteamThing("Humidity", "2nd Floor Steam Sensor", "Humidity", client);

     

                    // Bind the Virtual Things
                    client.bindThing(sensor1);
                    client.bindThing(sensor2);

     

                    // client.connect();
                    // Start the client
                    client.start();
                }
                catch (Exception eStart)
                {
                    Console.WriteLine("Initial Start Failed : " + eStart.Message);
                }

     


     


     

    com.thingworx.common.exceptions.TwApiException
      _HResult=-2146233088
      _message=Error opening connecting to Platform. There was an error initializing the Socket. (Code 1001)
      HResult=-2146233088
      IsTransient=false
      Message=Error opening connecting to Platform. There was an error initializing the Socket. (Code 1001)
      Source=thingworx-dotnet-common
      Code=1001