Skip to content

how can i send print commands one line at a time with ImmediateNetworkPrinter? #224

Answered by lukevp
xZeroKooLx asked this question in Q&A
Discussion options

You must be logged in to vote

You have to await asynchronous calls in order to make sure they are complete before the next call. The standard in C# is to name methods with the Async suffix to indicate that they are asynchronous. Your IDE should have given you a warning as well. You can tell a call is Async also because it will return a Task rather than a direct value.

the reason your writes are out of order is that you’re not awaiting the methods properly. All of them are going in at once and they are competing in an indeterminate order.

It works with the plain network printer because it internally buffers all writes and flushes them in order for you.

please give it a try with async/await and let me know if you still …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@xZeroKooLx
Comment options

Answer selected by lukevp
Comment options

You must be logged in to vote
1 reply
@nedigan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants