91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.03MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-08-16
  • 語(yǔ)言: C#
  • 標(biāo)簽: MQTT客戶??Apollo??

資源簡(jiǎn)介

C#語(yǔ)言,編寫MQTT客戶端,連接到實(shí)驗(yàn)3的MQTT服務(wù)器上,發(fā)布一個(gè)主題,并且訂閱主題。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Net;
using?System.Net.Sockets;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?uPLibrary.Networking.M2Mqtt;
using?uPLibrary.Networking.M2Mqtt.Messages;

namespace?ApolloClientM2Mqtt
{
????public?partial?class?ClientForm?:?Form
????{
????????private?MqttClient?client;
????????private?string?topic?=?““;

????????private?delegate?void?MessDelegate(T?obj);

????????public?ClientForm()
????????{
????????????InitializeComponent();
????????????textBoxLS.ForeColor?=?Color.Peru;
????????????btnLose.Enabled?=?false;
????????????btnCa.Enabled?=?false;
????????????comboBoxPub.SelectedIndex?=?1;
????????????comboBoxSub.SelectedIndex?=?1;
????????}

????????///?
????????///?連接apache?apollo
????????///?

????????private?void?linkClick(object?sender?EventArgs?e)
????????{
????????????string?clientId?=?““;
????????????string?ip?=?““;
????????????string?port?=?““;
????????????if?(String.IsNullOrEmpty(textBoxCT.Text))
????????????{
????????????????MessageBox.Show(“請(qǐng)輸入客戶機(jī)標(biāo)識(shí)!“);
????????????????return;
????????????}
????????????if?(String.IsNullOrEmpty(textBoxAD.Text)?&&?textBoxAD.Text.IndexOf(‘:‘)?<=?0)
????????????{
????????????????MessageBox.Show(“請(qǐng)輸入IP地址且?guī)Ф丝谔?hào)!“);
????????????????return;
????????????}
????????????//生成客戶端ID并連接服務(wù)器
????????????clientId?=?Guid.NewGuid().ToString();
????????????textBoxCT.Text?=?clientId;
????????????ip?=?textBoxAD.Text.Substring(0?textBoxAD.Text.IndexOf(‘:‘));
????????????port?=?textBoxAD.Text.Substring(textBoxAD.Text.IndexOf(‘:‘)?+?1);

????????????try
????????????{

????????????????//創(chuàng)建客戶端實(shí)例
????????????????client?=?new?MqttClient(ip?Convert.ToInt32(port)
???????????????????????????????????????????????false//?開(kāi)啟TLS
???????????????????????????????????????????????MqttSslProtocols.TLSv1_0?//?TLS版本
???????????????????????????????????????????????null
???????????????????????????????????????????????null
??????????????????????????????????????????????);
????????????????//client?=?new?MqttClient(IPAddress.Parse(ip)?Convert.ToInt32(port)?false?null);
????????????????client.ProtocolVersion?=?MqttProtocolVersion.Version_3_1;
????????????????//?admin和password是之前在apache?apollo中設(shè)置的用戶名和密碼
????????????????byte?code?=?client.Connect(clientId
????????????????????????????????????????“admin“
????????????????????????????????????????“password“);?//?keepAlivePeriod
????????????????//client.Connect(clientId?“admin“?“password“?false?0x01?false?null?null?true?60);
????????????????buttonlink.Enabled?=?false;
????????????????btnLose.Enabled?=?true;
????????????????textBoxLS.ForeColor?=?Color.LimeGreen;
????????????????textBoxLS.Text?=?“已連接“;
????????????}
????????????catch?(Exception?ee)
????????????{
????????????????MessageBox.Show(“無(wú)法連接,請(qǐng)確定代理服務(wù)器是否啟動(dòng),IP端口是否正確“

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

????..A..H.?????76288??2019-05-03?17:01??M2MQTT\.vs\M2MQTT\v14\.suo

?????文件???????4153??2019-05-02?23:17??M2MQTT\ApolloClientM2Mqtt\ApolloClientM2Mqtt.csproj

?????文件????????187??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\App.config

?????文件??????16384??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\bin\Debug\ApolloClientM2Mqtt.exe

?????文件????????187??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\bin\Debug\ApolloClientM2Mqtt.exe.config

?????文件??????24064??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\bin\Debug\ApolloClientM2Mqtt.pdb

?????文件??????22696??2019-05-03?16:57??M2MQTT\ApolloClientM2Mqtt\bin\Debug\ApolloClientM2Mqtt.vshost.exe

?????文件????????187??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\bin\Debug\ApolloClientM2Mqtt.vshost.exe.config

?????文件????????490??2018-04-12?07:35??M2MQTT\ApolloClientM2Mqtt\bin\Debug\ApolloClientM2Mqtt.vshost.exe.manifest

?????文件??????55808??2019-04-27?18:10??M2MQTT\ApolloClientM2Mqtt\bin\Debug\M2Mqtt.Net.dll

?????文件?????185856??2019-04-27?18:10??M2MQTT\ApolloClientM2Mqtt\bin\Debug\M2Mqtt.Net.pdb

?????文件???????8567??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\ClientForm.cs

?????文件??????14606??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\ClientForm.Designer.cs

?????文件???????5817??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\ClientForm.resx

?????文件????????180??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\obj\Debug\ApolloClientM2Mqtt.ClientForm.resources

?????文件????????820??2019-05-03?16:57??M2MQTT\ApolloClientM2Mqtt\obj\Debug\ApolloClientM2Mqtt.csproj.FileListAbsolute.txt

?????文件???????1017??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\obj\Debug\ApolloClientM2Mqtt.csproj.GenerateResource.Cache

?????文件???????8894??2019-05-02?23:17??M2MQTT\ApolloClientM2Mqtt\obj\Debug\ApolloClientM2Mqtt.csprojResolveAssemblyReference.cache

?????文件??????16384??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\obj\Debug\ApolloClientM2Mqtt.exe

?????文件??????24064??2019-05-03?00:33??M2MQTT\ApolloClientM2Mqtt\obj\Debug\ApolloClientM2Mqtt.pdb

?????文件????????180??2019-05-02?23:17??M2MQTT\ApolloClientM2Mqtt\obj\Debug\ApolloClientM2Mqtt.Properties.Resources.resources

?????文件???????1452??2019-04-26?15:26??M2MQTT\ApolloClientM2Mqtt\obj\Debug\DesignTimeResolveAssemblyReferences.cache

?????文件???????7185??2019-05-02?23:09??M2MQTT\ApolloClientM2Mqtt\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

?????文件??????????0??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

?????文件??????????0??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

?????文件??????????0??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

?????文件????????135??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\packages.config

?????文件????????743??2019-05-03?17:01??M2MQTT\ApolloClientM2Mqtt\Program.cs

?????文件???????1344??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\Properties\AssemblyInfo.cs

?????文件???????2849??2019-04-26?14:22??M2MQTT\ApolloClientM2Mqtt\Properties\Resources.Designer.cs

............此處省略164個(gè)文件信息

評(píng)論

共有 條評(píng)論