Questions tagged [nsstream]

NSStream is an abstract class for objects representing streams.

NSStream is an abstract class for objects representing streams. Its interface is common to all Cocoa stream classes, including its concrete subclasses NSInputStream and NSOutputStream.

NSStream objects provide an easy way to read and write data to and from a variety of media in a device-independent way.

For more information : NSStream Class Reference

327 questions
6
votes
1 answer

External Accessory stream does not work 100% of the time

The input and output streams get opened all the time and the respective delegate methods get called with the correct NSStreamEvent code (NSStreamEventOpenCompleted). However, on some openSession attempts the streams get opened successfully but they…
jason
  • 134
  • 1
  • 4
6
votes
1 answer

How to configure CFStream (or NSStream) for SSL handshake?

I'm using CFStream/NSStream to make http connections. I want to be able to detect that a SSL handshake fails for three cases: case A: server is not trusted case B: server is trusted but asks a client certificate case C: server is not trusted and it…
MohG
  • 351
  • 4
  • 11
6
votes
0 answers

NSStream streamError 57 - Socket is not connected happening intermittently and consistently

After making some changes to my app for iOS 6 (none of them actually pertaining to networking), I started encountering a strange error with my stream event handler. This is occurring on both iOS 5 and iOS 6, however much more frequently on iOS 5.…
John Hall
  • 1,346
  • 13
  • 27
5
votes
0 answers

Writing to NSOutputStream cause high cpu usage

While instrumenting my app I found that CPU usage jumps to 90% when writing data to output stream. Specifically, when network speed is very high. When I profile it With Timer instrument, found that most of the cpu is used for NSStream delegate call.…
K_Mohit
  • 528
  • 3
  • 17
5
votes
1 answer

EXC_BREAKPOINT randomly using NSOutputStream

I'm writing an app which uses NSOutputStream. I init connection like this: delegate = self; CFReadStreamRef readStream; CFWriteStreamRef writeStream; CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)url,port, &readStream,…
ibrig
  • 51
  • 1
5
votes
1 answer

iOS8 AVAudioEngine how to send microphone data over Multipeer Connectivity?

I want to send microphone audio data over Multipeer Connectivity (iOS 8) and play it through the speaker of the receiving peer. I've also setup the AVAudioEngine and I can hear the microphone data from the (upper) speaker output, but I don't know…
5
votes
1 answer

Disable Nagle's algorithm for NSOutputStream

I am creating a multiplayer game using MPCF. You control a spacehip on the iPad using the iPhone. I am experiencing various amount of lag and latency and buffering/pauses at random times and intervals and have now landed on Apples Technical Q&A…
5
votes
0 answers

How to get low latency sending motion data between iOS devices, and what should I expect?

I want to control a space ship on the iPad using the accelerometer on an iPhone. The devices are connected using Multipeer Connectivity Framework. I am sending accelerometer data using the regular sendData method on the session object that links the…
bobmoff
  • 2,415
  • 3
  • 25
  • 32
5
votes
1 answer

Problem with NSStream SSL Connection

I am using NSStream with SSL property for socket connection. It works fine when I use the local IP address such as 192.168.1.77. But if I use any server like www.xyz.com (it has SecurityLevelTLSv1), it shows an error error code:-9843,…
5
votes
2 answers

NSStream TCP Keep-alive iOS

I have written this code to setup a stream with a server: -(void)streamOpenWithIp:(NSString *)ip withPortNumber:(int)portNumber; { CFReadStreamRef readStream; CFWriteStreamRef writeStream; …
Jim Craane
  • 186
  • 3
  • 10
5
votes
1 answer

iOS client/server implementation and "Operation now in progress" error

Background I have been kind of teaching myself about sockets and network programming from various sample code and the classic Unix Network Programming textbook while simultaneously trying to put the knowledge to work in an app that I am working on…
RyanM
  • 4,474
  • 4
  • 37
  • 44
5
votes
3 answers

NSInputStream does not call Delegate (stream:handleEvent:)

I searched the web for a long time...I didn't find an answer for my issue, so I decided to post here. I try to establish a connection to a NNTP-server using NSStream. In a test-program, I open the streams and send a message. The delegate-method…
matrau
  • 148
  • 1
  • 9
5
votes
1 answer

bytesWritten, but other device never receives NSStreamEventHasBytesAvailable event

I have set up a Bonjour network between an iPhone and a Mac. The user chooses the iPhone’s net service in a table presented in the Mac, and a pair of streams are created and opened on both sides. The iPhone starts by sending a code (an integer) to…
Wienke
  • 3,723
  • 27
  • 40
4
votes
0 answers

iOS StreamStatus always returns NSStreamStatusOpen

Just had a question regarding the streamStatus of a NSStream. In my application I have an input stream and an output stream that work well in sending and receiving data. Earlier, however, I've noticed that should the server go down I wasn't…
Seb
  • 3,414
  • 10
  • 73
  • 106
4
votes
3 answers

How should you handle the possibility of an NSStream blockage?

Per Apple’s “Polling Versus Run-Loop Scheduling”: [hasSpace/BytesAvailable] can mean that there is available bytes or space or that the only way to find out is to attempt a read or a write operation (which could lead to a momentary block). The doc…
Wienke
  • 3,723
  • 27
  • 40
1 2
3
21 22