Skip to content

Instantly share code, notes, and snippets.

@hatsunea
Last active June 30, 2022 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hatsunea/713e9cd7952d700c23754cc1e50c6a86 to your computer and use it in GitHub Desktop.
Save hatsunea/713e9cd7952d700c23754cc1e50c6a86 to your computer and use it in GitHub Desktop.
// Azure IoT Hub 接続
var azureCert = new X509Certificate(Resource.GetBytes(Resource.BinaryResources.BaltimoreCyberTrustRoot));
Client = new DeviceClient(HostName, DeviceId, SharedAccessKey, azureCert: azureCert);
while (true)
{
try
{
if (Client.Open()) break;
}
catch
{
Console.CursorTop--; Console.WriteLine($" > Connect Faild");
Thread.Sleep(1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment