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
141
votes
18 answers

Objective-C: Reading a file line by line

What is the appropriate way of dealing with large text files in Objective-C? Let's say I need to read each line separately and want to treat each line as an NSString. What is the most efficient way of doing this? One solution is using the NSString…
Jonathan
48
votes
3 answers

How to callback NSStreamDelegate with NSStreamEventOpenCompleted?

I have been working on a NSStreamDelegate, I have implemented call back, I have initialized the input and output stream ilke this... CFReadStreamRef readStream; CFWriteStreamRef writeStream; CFStringRef host = CFSTR("74.125.224.72"); …
Newbee
  • 3,231
  • 7
  • 42
  • 74
18
votes
2 answers

Receiving Data from NSInputStream in Swift

I try to send and receive data with NSOutputStream and NSInputStream in Swift. The sending of data is working well, but i have some questions about the receiving. I found a solution with handling the NSStreamEvent, which i have tried. First of all…
hoedding
  • 257
  • 1
  • 4
  • 14
14
votes
4 answers

Buffering NSOutputStream used as NSInputStream?

I have this consumer class that takes an NSInputStream as argument which will be processed async, and I want to push data that comes from a producer class that requires that it has an NSOutputStream provided as its output source. Now how could I set…
cahlbin
  • 1,039
  • 10
  • 17
14
votes
2 answers

Convert incoming NSStream to View

I'm successfully sending a stream of NSData. The delegate method below is getting that stream and appending to NSMutableData self.data. How do I take this data and make it into a UIView/AVCaptureVideoPreviewLayer (which should show video)? I feel…
Eric
  • 4,063
  • 2
  • 27
  • 49
13
votes
1 answer

SWIFT ONLY -- Reading from NSInputStream

Could you please explain me how do I read properly from an NSInputStream? I couldn't understand what is UnsafePointer and what's the use of it (also for UnsafeArray). The NSInputStream read function gets an CMutablePointer which can be filled with…
johni
  • 5,342
  • 6
  • 42
  • 70
12
votes
2 answers

NSStream and Sockets, NSStreamDelegate methods not being called

I've followed the guide Setting Up Socket Streams and have effectively duplicated that code in my class. No matter what I try the delegate methods just don't seem to get called. In the header file I have (basically): @interface myClass : NSObject…
arrtchiu
  • 1,076
  • 1
  • 10
  • 23
12
votes
3 answers

How to Transfer Large Files over wifi in iOS

I downloaded WiTap Code From Apple's website. Its for transferring data over local wifi network. I am working in a project to interact as client - server architecture. I am sending NSData from client side to server. I made 2 projects; one for…
HarshIT
  • 4,583
  • 2
  • 30
  • 60
11
votes
1 answer

Enqueueing into NSInputStream?

I would like to add three "parts" to an NSInputStream: an NSString, an output from another stream and then another NSString. The idea is the following: The first and last NSStrings represent the beginning and end of a SOAP request while the output…
PeterD
  • 642
  • 1
  • 6
  • 17
9
votes
1 answer

Connecting to Redis server with NSStream in Swift

Hi everyone as the title mention I'm trying to send and receive data from my Redis server in swift language. I have done a lot of research and I can't come across a good answer about this topic, closest I have come to is NSStream or a few Github…
Brian Nezhad
  • 6,148
  • 9
  • 44
  • 69
9
votes
2 answers

Sending UIImage over NSOutputStream

I'm trying to send an image that user takes to the server. I get the JPEG representation, append that to the string needed to upload the photo, and then send the data through NSOutputStream. However, when I try to get the photo back from server, I…
Arman Shan
  • 101
  • 1
  • 3
9
votes
2 answers

scheduleInRunLoop - threading network connections

I've not found any decent documentation that explains the threading process for NSStream. To be specific, let's go for NSInputStream. Threading in Objective-C to me is currently a mystery simply because it appears to be so simple. What my question…
Kieran Senior
  • 17,960
  • 26
  • 94
  • 138
9
votes
1 answer

How to properly open and close a NSStream on another thread

I have an application that connects to a server using NSStream on another thread. The application also closes the connection should the user decide to log out. The problem is that I am never able to successfully close the stream or the thread upon…
Seb
  • 3,414
  • 10
  • 73
  • 106
9
votes
1 answer

Is it possible to determine the NSRunLoop/NSThread that is associated with an open NSStream?

I am using (and am required to use) a third-party framework to which I do not have source. The third-party framework handles creating an authenticated client/server connection and hands back a pair of open NSStreams. The stream creation process, per…
xyzzycoder
  • 1,831
  • 13
  • 19
8
votes
5 answers

NSStreams Crashing Program!

All, I've run it down to this point by commenting, breakpoints, etc. The program crashes at the marked code. -(void) initNetworkCommunication { CFReadStreamRef readStream; CFWriteStreamRef writeStream; …
Baub
  • 5,004
  • 14
  • 56
  • 99
1
2 3
21 22