From 546f69a69dac65b62dc590d35d6363137c2156a8 Mon Sep 17 00:00:00 2001 From: Thomas Luijken Date: Mon, 9 Sep 2024 11:20:00 +0200 Subject: [PATCH] Added cancellation_token for connect async --- SickRfid/DisconnectedSickRfidController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SickRfid/DisconnectedSickRfidController.cs b/SickRfid/DisconnectedSickRfidController.cs index cb3977c..e82cea3 100644 --- a/SickRfid/DisconnectedSickRfidController.cs +++ b/SickRfid/DisconnectedSickRfidController.cs @@ -18,10 +18,10 @@ internal DisconnectedSickRfidController(IPAddress ipAddress, int port) _port = port; } - public async Task ConnectAsync() + public async Task ConnectAsync(CancellationToken cancellationToken = default) { var socket = new Socket(SocketType.Stream, ProtocolType.Tcp); - await socket.ConnectAsync(_ipAddress, _port).ConfigureAwait(true); + await socket.ConnectAsync(_ipAddress, _port, cancellationToken).ConfigureAwait(true); return new ConnectedSickRfidController().SetSocket(socket); } -} \ No newline at end of file +}