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
4
votes
2 answers

Locking iPhone disconnects sockets on iOS 5 only

I'm working on a socket based client-server app. When a user running any iDevice on iOS 4, 4.2.1, 4.3.2, etc clicks the lock button while connected to the server, the connection remains alive. However, when I click the lock button on any device…
James V
  • 189
  • 1
  • 2
  • 10
4
votes
1 answer

how to call NSStream Synchronously

How to call NSStream synchronously to get the results?? Presently I am getting a async call back in one of its delegate methods `(void)stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent`-
Shri
  • 2,129
  • 2
  • 22
  • 32
4
votes
2 answers

Bonjour in the Background?

I noticed that Pasteboard, a clipboard app for iOS, can run Bonjour service in the background. I've no idea how they implement that, so I searched on the Internet and then found that it plays a silent sound file when in background. But it is not…
nonamelive
  • 6,510
  • 8
  • 40
  • 47
4
votes
2 answers

How to read data from NSInputStream explicitly in swift?

I am using a socket connect in my application. Here's my SocketConnection.swift init(host: String, port:UInt32){ self.host = host self.port = port self.status = false output = "" super.init() } …
iosLearner
  • 1,312
  • 1
  • 16
  • 30
4
votes
1 answer

iOS NSStream FTP not responding after 5 minutes of inactivity

I am using a FTP library for iOS (nkreipke/FTPManager). It works great. I can download a list of directories, upload images, etc. The problem is that if you leave the app open for like 5 minutes doing nothing and then you try to download or upload,…
Axort
  • 2,034
  • 2
  • 23
  • 24
4
votes
1 answer

RN42 Bluetooth disconnects on iOS within seconds of streaming data

I've been trying to read data from a device via Bluetooth 2.1 using an RN-42. The device pairs to an iPhone or iPad Mini, and data is streamed across briefly, but the iOS & BT module disconnect (unpair) within seconds (less than 10). The device is…
4
votes
1 answer

NSOutputStream crashing with Bad Access after write (Objective-c)

I have been trying to get a basic TCP client up and running for my iOS application but have run into a block which i cannot seem to work my head around. So far i can connect, send a message which is received on the server side but then my app…
4
votes
1 answer

iOS gamekit/bluetooth data streaming

I have a written a program using gamekit/bluetooth to transfer low quality video using compressed jpegs from one iOS device to another. I do already realize that gamekit/bluetooth should not be used for this purpose (for small chunks of data) but…
iOScoder
  • 181
  • 1
  • 12
4
votes
1 answer

How to reconnect when a NSStream loses connection?

I am building an app that monitors the position of the user, and sends it via a socket to our server. On app startup the app connects to the socket on our server, and are we able to send data to the server. But when the user changes from cell to…
George Boot
  • 585
  • 2
  • 8
  • 17
4
votes
1 answer

Subclassing NSInputStream to upload a particular portion of data from a local filepath

I am having a 100 MB of data in a single file. This 100 mb data will be divided virtually. i.e., I need to create an NSInputStream which points to different 5MB chunks. This is possible by creating the stream with NSData. But rather I'd like to know…
Sj.
  • 1,674
  • 2
  • 15
  • 23
4
votes
1 answer

NSStream don't send all data

My case is quite strange: I practically used the example "SimpleFTPSample" (some small variation of the type [self.networkStream setProperty: (id) kCFBooleanFalse forKey: (NSString *) kCFStreamPropertyFTPAttemptPersistentConnection]; to avoid…
4
votes
1 answer

Scheduling NSStream events on an NSRunLoop that isn't the main run loop

I'm scheduling events on the main run loop using the following code: [stream setDelegate:self]; [stream scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; [stream open]; I assume that this means that NSStreamDelegate events…
chris838
  • 5,148
  • 6
  • 23
  • 27
4
votes
1 answer

NSStream Handle Event Giving Status 4

I was trying on a TCP connection app, and I am getting a NSStreamEvent "4" on handleEvent. What am I doing wrong? My code is like, -(void) initNetworkCommunication { CFReadStreamRef readStream; CFWriteStreamRef…
4
votes
2 answers

Using NSXMLParser initWithStream: no parser delegate methods received

The basic problem I'm working on is using the NSStream classes to parse incoming incremental XML data. The data is never a complete XML Document, but I want to receive and process it in incremental chunks based off how much ever the socket can…
John Drake
  • 183
  • 1
  • 8
3
votes
1 answer

NSStream, getting percentage of bytes read

I am uploading a file to a server, using NSStream APIs to read in chunks. I'm trying to display a progress bar showing upload progress. I'm unable to find a reliable solution for determining the number of bytes read into the file. Changing file and…
akaru
  • 6,299
  • 9
  • 63
  • 102