Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. OVERLAPPED Serial Communication

OVERLAPPED Serial Communication

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    louis 0
    wrote on last edited by
    #1

    I am currenlty going through a former colleague's code who used OVERLAPPED I/O to receive asynchronous serial data. The program first declare a pointer variable pRxBuffer which will contain the received data. It then creates the port, then creates an overlapped event, and then reads the port which contains no data. The program then waits indefinitely using WaitForMultipleObjects function. When the data arrives, the pointer variable pRxBuffer is immediately filled with the received data without using the ReadFile fucntion (or so it seems) and prior to calling the GerOverlappedResult function. If this makes sense to someone, can you please explain to me how this is possible? How is the data transferred to pRxBuffer. Thanks

    S 1 Reply Last reply
    0
    • L louis 0

      I am currenlty going through a former colleague's code who used OVERLAPPED I/O to receive asynchronous serial data. The program first declare a pointer variable pRxBuffer which will contain the received data. It then creates the port, then creates an overlapped event, and then reads the port which contains no data. The program then waits indefinitely using WaitForMultipleObjects function. When the data arrives, the pointer variable pRxBuffer is immediately filled with the received data without using the ReadFile fucntion (or so it seems) and prior to calling the GerOverlappedResult function. If this makes sense to someone, can you please explain to me how this is possible? How is the data transferred to pRxBuffer. Thanks

      S Offline
      S Offline
      soundman32
      wrote on last edited by
      #2

      That's how it works. Basically, the initial ReadFile tells windows: here is a buffer, and here is the overlapped event is where I want you to tell me when you've filled the buffer. There should also be a check on the return of ReadFile to check if the data has already arrived (which is possible). Neil

      L 1 Reply Last reply
      0
      • S soundman32

        That's how it works. Basically, the initial ReadFile tells windows: here is a buffer, and here is the overlapped event is where I want you to tell me when you've filled the buffer. There should also be a check on the return of ReadFile to check if the data has already arrived (which is possible). Neil

        L Offline
        L Offline
        louis 0
        wrote on last edited by
        #3

        Thank you. It confirms my suspicions. I was however unable to detect it in the MSDN notes. Cheers

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups