Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #171 from Azure-Samples/azabbasi/fixQuickStart - F…
Browse files Browse the repository at this point in the history
…ix QuickStart samples build
  • Loading branch information
azabbasi committed Dec 9, 2020
2 parents 15a5e4f + 6765560 commit 39c99b2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.29.0-preview-*" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.32.0-preview-001" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace Microsoft.Azure.Devices.Client.Samples
{
public class DeviceStreamSample
{
private DeviceClient _deviceClient;
private String _host;
private int _port;
private readonly DeviceClient _deviceClient;
private readonly string _host;
private readonly int _port;

public DeviceStreamSample(DeviceClient deviceClient, String host, int port)
public DeviceStreamSample(DeviceClient deviceClient, string host, int port)
{
_deviceClient = deviceClient;
_host = host;
Expand All @@ -44,7 +44,7 @@ private static async Task HandleOutgoingDataAsync(NetworkStream localStream, Cli
while (localStream.CanRead)
{
int receiveCount = await localStream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);

await remoteStream.SendAsync(new ArraySegment<byte>(buffer, 0, receiveCount), WebSocketMessageType.Binary, true, cancellationToken).ConfigureAwait(false);
}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ public async Task RunSampleAsync(bool acceptDeviceStreamingRequest, Cancellation
{
await _deviceClient.AcceptDeviceStreamRequestAsync(streamRequest, cancellationTokenSource.Token).ConfigureAwait(false);

using (ClientWebSocket webSocket = await DeviceStreamingCommon.GetStreamingClientAsync(streamRequest.Url, streamRequest.AuthorizationToken, cancellationTokenSource.Token).ConfigureAwait(false))
using (ClientWebSocket webSocket = await DeviceStreamingCommon.GetStreamingClientAsync(streamRequest.Uri, streamRequest.AuthorizationToken, cancellationTokenSource.Token).ConfigureAwait(false))
{
using (TcpClient tcpClient = new TcpClient())
{
Expand All @@ -93,7 +93,7 @@ await Task.WhenAny(
}
}

await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, String.Empty, cancellationTokenSource.Token).ConfigureAwait(false);
await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, cancellationTokenSource.Token).ConfigureAwait(false);
}
}
else
Expand Down
10 changes: 5 additions & 5 deletions iot-hub/Quickstarts/device-streams-proxy/device/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.Azure.Devices.Client.Samples
{
public static class Program
{
// String containing Hostname, Device Id & Device Key in one of the following formats:
// String containing Host Name, Device Id & Device Key in one of the following formats:
// "HostName=<iothub_host_name>;DeviceId=<device_id>;SharedAccessKey=<device_key>"
// "HostName=<iothub_host_name>;CredentialType=SharedAccessSignature;DeviceId=<device_id>;SharedAccessSignature=SharedAccessSignature sr=<iot_host>/devices/<device_id>&sig=<token>&se=<expiry_time>";

Expand All @@ -32,10 +32,10 @@ public static class Program
private static string s_port = Environment.GetEnvironmentVariable("REMOTE_PORT");

// Select one of the following transports used by DeviceClient to connect to IoT Hub.
private static TransportType s_transportType = TransportType.Amqp;
//private static TransportType s_transportType = TransportType.Mqtt;
//private static TransportType s_transportType = TransportType.Amqp_WebSocket_Only;
//private static TransportType s_transportType = TransportType.Mqtt_WebSocket_Only;
private static readonly TransportType s_transportType = TransportType.Amqp;
//private static readonly TransportType s_transportType = TransportType.Mqtt;
//private static readonly TransportType s_transportType = TransportType.Amqp_WebSocket_Only;
//private static readonly TransportType s_transportType = TransportType.Mqtt_WebSocket_Only;

public static int Main(string[] args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace Microsoft.Azure.Devices.Samples
{
public class DeviceStreamSample
{
private ServiceClient _serviceClient;
private String _deviceId;
private int _localPort;
private readonly ServiceClient _serviceClient;
private readonly string _deviceId;
private readonly int _localPort;

public DeviceStreamSample(ServiceClient deviceClient, String deviceId, int localPort)
public DeviceStreamSample(ServiceClient deviceClient, string deviceId, int localPort)
{
_serviceClient = deviceClient;
_deviceId = deviceId;
Expand Down Expand Up @@ -66,7 +66,7 @@ private static async void HandleIncomingConnectionsAndCreateStreams(string devic
try
{
using (var cancellationTokenSource = new CancellationTokenSource())
using (var remoteStream = await DeviceStreamingCommon.GetStreamingClientAsync(result.Url, result.AuthorizationToken, cancellationTokenSource.Token).ConfigureAwait(false))
using (var remoteStream = await DeviceStreamingCommon.GetStreamingClientAsync(result.Uri, result.AuthorizationToken, cancellationTokenSource.Token).ConfigureAwait(false))
{
Console.WriteLine("Starting streaming");

Expand All @@ -75,7 +75,7 @@ await Task.WhenAny(
HandleOutgoingDataAsync(localStream, remoteStream, cancellationTokenSource.Token)).ConfigureAwait(false);
}

Console.WriteLine("Done streaming");
Console.WriteLine("Done streaming");
}
catch (Exception ex)
{
Expand Down
4 changes: 2 additions & 2 deletions iot-hub/Quickstarts/device-streams-proxy/service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static class Program
private static string s_port = Environment.GetEnvironmentVariable("LOCAL_PORT");

// Select one of the following transports used by ServiceClient to connect to IoT Hub.
private static TransportType s_transportType = TransportType.Amqp;
//private static TransportType s_transportType = TransportType.Amqp_WebSocket_Only;
private static readonly TransportType s_transportType = TransportType.Amqp;
//private static readonly TransportType s_transportType = TransportType.Amqp_WebSocket_Only;

public static int Main(string[] args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices" Version="1.27.0-preview-*" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.28.0-preview-001" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Net.WebSockets.Client" Version="4.3.2" />
</ItemGroup>
Expand Down

0 comments on commit 39c99b2

Please sign in to comment.