Skip to content

Commit

Permalink
Merge pull request #35 from Baseflow/cancellation_token_stop_async
Browse files Browse the repository at this point in the history
Added cancellation_token for connect async
  • Loading branch information
tluijken authored Sep 9, 2024
2 parents fb243e8 + 546f69a commit bc52549
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 bc52549

Please sign in to comment.