private async void listener_ConnectionReceived(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args) { await Task.Factory.StartNew (() => { try { // create network channel to accept connection request IMqttNetworkChannel channel = new MqttNetworkChannel(args.Socket); channel.Accept(); // handling channel for connected client MqttClient client = new MqttClient(channel); // raise client raw connection event this.OnClientConnected(client); } catch (Exception) { // TODO : check errors/exceptions on accepting connection } }); }
private async void listener_ConnectionReceived(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args) { await Task.Factory.StartNew (() => { try { // create network channel to accept connection request IMqttNetworkChannel channel = new MqttNetworkChannel(args.Socket); channel.Accept(); // handling channel for connected client MqttClient client = new MqttClient(channel); // raise client raw connection event this.OnClientConnected(client); } catch (Exception) { // TODO : check errors/exceptions on accepting connection } }); }