Einzelnen Beitrag anzeigen

Photoner

Registriert seit: 6. Dez 2012
Ort: Nürnberg
103 Beiträge
 
Delphi 10.1 Berlin Starter
 
#9

AW: COM Port Daten auslesen und auf bestimmtes Char reagieren

  Alt 8. Feb 2016, 15:32
Bin beim lesen darauf gestoßen:

Zitat MSDN:
------------------------------------------------------------------------------------------------------------------------------
ReadIntervalTimeout

The maximum time allowed to elapse before the arrival of the next byte on the communications line, in milliseconds. If the interval between the arrival of any two bytes exceeds this amount, the ReadFile operation is completed and any buffered data is returned. A value of zero indicates that interval time-outs are not used.

A value of MAXDWORD, combined with zero values for both the ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier members, specifies that the read operation is to return immediately with the bytes that have already been received, even if no bytes have been received.

------------------------------------------------------------------------------------------------------------------------------

Setz das und lese als Reaktion auf dein Event.

Dein Event "#10 Empfangen" wird gefeuert --> du hast einen kompletten String im Buffer und einen ziemlich exakten Zeitstempel.

Readfile blockiert mit der oben erwähnten Einstellung nicht (Zeitstempel hier ist also auch ok) und kommt sofort zurück (Wenn du 1024 bytes anforderst bekommst du trotzdem nur das was im Buffer -Stichwort ReceivedBytes- ist)

Zufrieden ?
Chris
  Mit Zitat antworten Zitat