CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Location
    Chandigarh(India)
    Posts
    97

    Is Data Reorder in IOCP

    Is there any reorder of Data during WSARECV [usingIOCP],
    If my messge is larger than socket Buffer, e.g. It will take 5 REC to get data [Chunk1,Chunk2....,Chunk5]


    Is there any possibilty Chunk2 came before Chunk1? If yes how to cancatinate message

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Is Data Reorder in IOCP

    Is there any possibilty Chunk2 came before Chunk1?
    If you issue multiple overlapped reads (FileRead etc) on a socket then the "bufferes" are filled in the same order as they are issued (first one first), but they may complete in a different order. That is, the second recv (containing the second buffer) may complete before the first one.

    If yes how to cancatinate message
    One way to "make it right" is to tag every read ops with an id (an increasing integer added to the overlapped structure). When the read op completes, check the id... this way know in what order the "buffers" were issued and thus in what order they should be concatenated.

    - petter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured