I am sending messages from my C#
application to IOT Hub
using below code snippet.
public async Task<MessageToTargetStatus> ForwardMessage(byte[] message)
{
var messageToSend = new Microsoft.Azure.Devices.Client.Message(message);
await iotHubClient.GetDeviceClient().SendEventAsync(messageToSend).ConfigureAwait(false);
return MessageToTargetStatus.Success;
}
Messages are successfully received at the Azure IOT Hub
Now I want to test my security of these messages and trying to verify these messages in WireShark.
I see many records in WireShark
, but I am not able to figure out which is my messages sent to IOT Hub.
How can I do it? I am using MQTT
at port 1833, running as `Windows Service'.
I have added filter as follow, but no luck
MQTT I might need to force the packets over a networkadapter, using localhost windows will use loopback instead of the network interface card. So how can I do it in WireShark?
Updated question with Device Explorer tool screenshot
When I send single message from Device Explorer
, I see many communication records in WireShark
. Which protocol I should be filtering?
Connection string - I am using Mqtt_WebSocket_Only
_hubClient = DeviceClient.CreateFromConnectionString(IotHubConnectionString, TransportType.Mqtt_WebSocket_Only);
Azure IoT Hub only supported security communication, for MQTT protocol it use 8883 port number. So you need change capture filter to tcp.port == 8883
.
Ref: Azure IoT Hub communication protocol and ports
Or find the Azure IoT Hub IP address using the following command:
ping [your-hub-name].azure-devices.net
Then use this filter:
ip.addr == [iothub-address]
If you use AMQP, its port is 5671. You can set filter in Wireshark like this:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.