Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最新版本客户端无法连接服务器 #7

Open
aprilyush opened this issue Nov 20, 2024 · 0 comments
Open

最新版本客户端无法连接服务器 #7

aprilyush opened this issue Nov 20, 2024 · 0 comments

Comments

@aprilyush
Copy link

升级到最新版本后 客户端无法连接服务器
`
static async Task Main(string[] args)
{
Console.WriteLine("Hello, World!");

XTrace.UseConsole();
try
{
  
    var mqttClient = new MqttClient
    {
        Log = XTrace.Log,
        Server = $"tcp://127.0.0.1:1883",
        UserName = "fofia",
        Password = "123123",
        ClientId = "fofia_client_faker111",
        Reconnect = true,
        KeepAlive = 30
    };

    var ack =await mqttClient.ConnectAsync();
    if (ack.ReturnCode == ConnectReturnCode.Accepted)
    {
        XTrace.WriteLine("MQTT已连接");

    }
}
catch (Exception ex)
{
    XTrace.WriteException(ex);
}
Console.ReadKey();

}
`
报错:A task was canceled.
微信截图_20241120151502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant