• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
readInBackgroundAndNotifyForModes problems...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

readInBackgroundAndNotifyForModes problems...


  • Subject: readInBackgroundAndNotifyForModes problems...
  • From: Alec Carlson <email@hidden>
  • Date: Sat, 06 Apr 2002 17:18:33 -0600

I'm using NSFileHandle:readInBackgroundAndNotifyForModes to read TCP packets
in the background. The NSFileHandle was created by taking a socket ID
returned from socket() and then calling NSFileHandle:initWithFileDescriptor
to create an NSFileHandle out of the socket ID. I then call connect() to
connect to a remote server and then
NSFileHandle:readInBackgroundAndNotifyForModes to have NSFileHandle read
packets in the background and call my observer when a packet arrives.

The problem is that my observer sometimes gets called with stale data. At
time X, my observer gets called with packet data A. At time X+1, my observer
gets called again with packet data A. It should contain packet data B. I
know that I don't receive the data on packet boundaries. That's not the
issue. The problem is I receive the same data twice. It looks like I'm
getting the same NSData object in successive
NSFileHandleReadCompletionNotification calls.

Is there anything special I have to do in my observer with the NSData object
passed in for a NSFileHandleReadCompletionNotification callback ? Any
thoughts on what's going on here ? Does this work for anyone else ?

Thanx -

Alec Carlson
-----------------------------------------------------------------------
Time is Short, and the Water Rises
-----------------------------------------------------------------------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: readInBackgroundAndNotifyForModes problems - mystery solved !
      • From: Alec Carlson <email@hidden>
  • Prev by Date: Re: Dockling not working, at all, no clue why!
  • Next by Date: Re: Dockling not working, at all, no clue why!
  • Previous by thread: Re: Dockling not working, at all, no clue why!
  • Next by thread: Re: readInBackgroundAndNotifyForModes problems - mystery solved !
  • Index(es):
    • Date
    • Thread