Skip to content

Commit

Permalink
Added cancellation_token for connect async
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Luijken committed Sep 9, 2024
1 parent fb243e8 commit 546f69a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SickRfid/DisconnectedSickRfidController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ internal DisconnectedSickRfidController(IPAddress ipAddress, int port)
_port = port;
}

public async Task<ConnectedSickRfidController> ConnectAsync()
public async Task<ConnectedSickRfidController> 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);
}
}
}

0 comments on commit 546f69a

Please sign in to comment.