Am 02.07.2010 um 19:43 schrieb Jens Alfke: > On Jul 2, 2010, at 5:36 AM, Alexander Spohr wrote: > >> I have some streams gotten from NSNetServices getInputStream:outputStream:. >> I send very small chunks (from 1 to 1000 bytes) of data through them. I >> would like to flush the stream after I wrote a chunk to get the data >> immediately sent to the other side. >> Is that possible or does the NSOutputStream flush after every >> write:maxLength: anyway? > > TCP has some finely-tuned algorithms to decide when to send the buffer. > Usually it’s best not to second-guess these, but there are some cases where > you do need to. Terminal protocols like telnet and ssh use setsockopt to set > a special immediate mode (I can’t remember the name of the option but it’s in > the man page.).
TCP_NODELAY is not in the man page. But your pointer made me remember the thing I needed: int yes = 1; setsockopt(CFSocketGetNative(aSocket), IPPROTO_TCP, TCP_NODELAY, (void *)&yes, sizeof(yes)); Thanks a lot, atze _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com