---
title: "Bigberm (@bigberm) | Hashnode"
description: "Bigberm (@bigberm) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@bigberm"
---

@bigberm

# Bigberm

@bigberm · Joined July 2022

## Comments

[behrooz bozorg chami This's my code. using System; using System.Threading; using System.Threading.Tasks; using MQTTnet.Server; using MQTTnet; using System.Text; using static System.Console; namespace MqttBroker { class Program { static void Main(string\[\] args) { // Create the options for MQTT Broker var options = new MqttServerOptionsBuilder() //Set endpoint to localhost .WithDefaultEndpoint(); // Create a new mqtt server var server = new MqttFactory().CreateMqttServer(options.Build()); //Add Interceptor for logging incoming messages server.InterceptingPublishAsync += Server\_InterceptingPublishAsync; // Start the server //await server.StartAsync(); server.StartAsync(); // Keep application running until user press a key ReadLine(); Task Server\_InterceptingPublishAsync(InterceptingPublishEventArgs arg) { // Convert Payload to string var payload = arg.ApplicationMessage?.Payload == null ? null : Encoding.UTF8.GetString(arg.ApplicationMessage?.Payload); WriteLine( " TimeStamp: {0} -- Message: ClientId = {1}, Topic = {2}, Payload = {3}, QoS = {4}, Retain-Flag = {5}", DateTime.Now, arg.ClientId, arg.ApplicationMessage?.Topic, payload, arg.ApplicationMessage?.QualityOfServiceLevel, arg.ApplicationMessage?.Retain); return Task.CompletedTask; } } } If I did comment out "//await server.StartAsync();" and used server.StartAsync(); it's ok. So,let me know solution,and also I am waiting for MQTT broker with username/password authenticated from clients request.](https://hashnode.com/posts/c-mqtt-broker-using-mqttnet-version-4/62d2fa7b1f070812ac2ad51d/comment/62d3a115e52a5d129a0c2156#reply-62d7f0d93df6e54ab8e5b14f)

Reply · Article · Jul 20, 2022 · [C# MQTT broker using MQTTnet version 4](https://hashnode.com/posts/c-mqtt-broker-using-mqttnet-version-4/62d2fa7b1f070812ac2ad51d)

[Hi, If possible,you should create the example MQTT client with MQTTnet 4.0.2.221. Thank you, Bigberm](https://hashnode.com/posts/start-mqtt-client-with-csharp/61e5823d8a425719c17367ad/comment/62d3b201bc2c7a1dc6726b1b)

Comment · Article · Jul 17, 2022 · [Start MQTT Client with C#](https://hashnode.com/posts/start-mqtt-client-with-csharp/61e5823d8a425719c17367ad)

[Hi, I got this error when using await in front of // Start the server await server.StartAsync(); "The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'." How to fix it? Thank you, Bigberm](https://hashnode.com/posts/c-mqtt-broker-using-mqttnet-version-4/62d2fa7b1f070812ac2ad51d/comment/62d3a115e52a5d129a0c2156)

Comment · Article · Jul 17, 2022 · [C# MQTT broker using MQTTnet version 4](https://hashnode.com/posts/c-mqtt-broker-using-mqttnet-version-4/62d2fa7b1f070812ac2ad51d)

[behrooz bozorg chami 1) I am writing an article about it. Thank you and waiting for this article topic "How to set username/password for c# MQTT Broker".](https://hashnode.com/posts/basic-mqtt-broker-with-c-sharp/61eb28425fbc177f9f3b3595/comment/62d230752f551b044bc1633b#reply-62d394d1e52a5d129a0c1fcc)

Reply · Article · Jul 17, 2022 · [Basic MQTT broker with C#](https://hashnode.com/posts/basic-mqtt-broker-with-c-sharp/61eb28425fbc177f9f3b3595)

[Hi, Sorry I want to know about this solution. 1) How to set username/password for c# MQTT Broker? 2) How to set retaining lastest published message on Broker from client's published message? Thank you, Bigberm](https://hashnode.com/posts/basic-mqtt-broker-with-c-sharp/61eb28425fbc177f9f3b3595/comment/62d230752f551b044bc1633b)

Comment · Article · Jul 16, 2022 · [Basic MQTT broker with C#](https://hashnode.com/posts/basic-mqtt-broker-with-c-sharp/61eb28425fbc177f9f3b3595)
