discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: writeData: does not send out data for 5-10 minutes


From: Andreas Höschler
Subject: Re: writeData: does not send out data for 5-10 minutes
Date: Mon, 19 Sep 2005 16:04:33 +0200

Hi Chris,

You can do something like

  - (NSData *) dataAvailableOnSocket // yes, stupid method name :-)
  {
    unsigned bytes;

    if( -1 == ioctl(yourSocket, FIONREAD, (char *) &bytes) )
    {
      // handle ioctl error here
      // eg. raise NSFileHandleOperationException
    }

    if( 0 == bytes ) return nil; // no data available

    return [yourFilehandle readDataOfLength: bytes];
  }

to check whether there is any data on the socket and immediately use it.

You mean the data (n bytes) is actually sent by machineA and also received by machineB but NSFileHandleReadCompletionNotification is not posted until at least N (N > n) bytes have been received?

If anyhow possible I would like to use the NSFileHandle notification mechanism versus polling for available data.

Can the timeout be reduced?

Thanks!

Regards,

  Andreas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]