[Top][All Lists]

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

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

From: Andreas Höschler
Subject: writeData: does not send out data for 5-10 minutes
Date: Mon, 19 Sep 2005 15:01:35 +0200

Hi all,

I am opening a socket on one machine and do

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(connectionAccepted:)
        name:FBConnectionAcceptedNotification object: nil];
      [self acceptConnectionInBackgroundAndNotify];     

I connect to this socket from another machine. This fires the following method:

- (void)connectionAccepted:(NSNotification *)notification
NSFileHandle *clientHandle = [[notification userInfo] objectForKey:NSFileHandleNotificationFileHandleItem];
   [clientHandle readInBackgroundAndNotify];

On the remote machine I send stuff using

        - [NSFileHandle writeData:]

and wait for

        - (void)readCompleted:(NSNotification *)notification

being called on the server end. This basically works. However, sometimes it takes 5 or more minutes before the data is received by the server. I assume that since I only sent a few bytes only and the data is kept until either more data is queued for transmission or a timeout occurs before the data is actually sent over the line. Can anybody confirm this assumption? What can i do about it? What I am looking for is some kind of flush mechanism (in NSFileHandle or directly on the socket) that sends out the data immediately regardless of how small the package is.

Thanks a lot!



reply via email to

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