Lars Skov

Lars Skov

  • NA
  • 1
  • 0

Best Practise using Async TCP/IP

Apr 22 2008 3:07 PM

Hi

I have made a Class for communicating Async with an Intermec Printer.
When I send an instruction the printer replies as it should.
But if I ask the printer to wait for the user to enter a value and return the answer to me I dont get it.

I send 'beep' and the printer goes beep!
I send Enter 123 and press enter. Nothing is returned
I send 'beep' printer returns 123 and goes beep.

If i call BeginReceive(...) inside my Data_Received_Call_Back i get the 123 because I then have a pending BeginReceive.
But if always call BeginReceive(...) inside my Data_Received_Call_Back i will end up having a lot of pending BeginReceive.

If I use HyperTerminal I get the 123 reply without sending any further commands.

What is best practise to handle this kind of communication