NSInputStream
is an Objective-C objective-c class on iOS ios,
a subclass of NSStream
nsstream that provides read-only stream functionality. NSInputStream
is “toll-free bridged” with its Core Foundation counterpart, CFReadStreamRef
.
Questions tagged [nsinputstream]
150 questions
0
votes
1 answer
unable to forcefully cancel ftp download
I am using SimpleFTPSample to download and upload from FTP server. I have to cancel download after specific time regardless of completion and start uploading. But If I cancel the download and then start upload delegate method stream:handleEvent: is…

user1101733
- 258
- 2
- 14
0
votes
1 answer
Not getting more messages after receiving first message from Java server in iOS client using NSInputStream
I've got a Java server (and it's able to correctly read a request from my iOS client -- it even generates a response and appears to send it correctly, though I got First message response from server every time but not getting other messages after…

user4388479
- 19
- 1
- 6
0
votes
0 answers
EXC_BAD_ACCESS with NSStreamEventHasBytesAvailable
This is a very confusing error, as even if I send and receive the same data it sometimes happens, sometimes doesn't.
I am receiving a stream via NSInputStream and I use standard code to read the bytes received in that stream and pass them onto…

Erken
- 1,448
- 16
- 23
0
votes
1 answer
NSInputStream read:maxLength: cannot read data, returns -1
In Objective C, I have somethng like this:
uint8_t f[400000];
NSString *Str;
unsigned int count = 0;
NSError* error = nil;
Str = [[NSString alloc]initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Test" ofType:@"txt"]…

Sibir
- 313
- 2
- 6
- 20
0
votes
1 answer
Cocoa Read NSInputStream from FTP connection
I (apparently) manage to make a ftp connection, but fail to read anything from it, and with good cause: I don't reach the reading until the connection has timed out.
Here's my code:
header:
NSInputStream *iStream;
NSOutputStream…

James
- 112
- 1
- 9
0
votes
1 answer
'NSInputStream' does not have a member named 'setDelegate'
I use NSStreamDelegate protocol in A UIViewController subclass,
And then send setDelegate message to a NSInputStream.
var input : NSInputStream?
var output: NSOutputStream?
func connectToSocket(host: String, port: Int) {
…

Chen-Tsu Lin
- 22,876
- 16
- 53
- 63
0
votes
1 answer
Loading an NSString to NSInputStream
In java I have something like this:
String data = "someFile.txt";
InputStream fin = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(data);
It basically initializes fin with the contents of a…

Sibir
- 313
- 2
- 6
- 20
0
votes
1 answer
NSInputStream from URL doesn't seem to be getting anything
I've got the following code, which I know is being run:
ReadDelegate * del = [[ReadDelegate alloc] init];
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)(@"server.com"), port,…

River Tam
- 3,096
- 4
- 31
- 51
0
votes
1 answer
Start NSInputStream at certain location
I have an input stream and I want to start reading bytes at a certain location. Is there any way I can do that? Say I want to read 1024 bytes at location n, n being the nth byte in the file. How do I achieve this? I've looked at the documentation…

Milo
- 5,041
- 7
- 33
- 59
0
votes
2 answers
NSMutableData encryption in place using NSInputStream
I am trying to use CommonCrypto to encrypt an NSMutableData object in place (copying the resulting bytes to itself, without duplicating it). Previously, I was using CCCrypt() "one-shot" method, mainly because it seemed simple. I noticed that my data…

József Vesza
- 4,775
- 3
- 27
- 42
0
votes
1 answer
initialising NSInputStream from a particular portion of file (copied in Document directory)?
I am uploading a large file from my iOS app and file transfer is in chunk upload. i am using the below code to initialise NSInputStream for Chunks.
// for example
NSInteger chunkCount = 20;
for(int i=0; i

iOS_Developer
- 495
- 4
- 20
0
votes
2 answers
iOS NSStream Socket Read TCP erratic and truncated
I am using the following code to read from a server socket. Everything starts out fine, but as things progress the data returned gets truncated and chunked incorrectly. I've read all over trying different things like changing the buffer size and…

chrislhardin
- 1,747
- 1
- 28
- 44
0
votes
1 answer
Async read large file results in blocks of null reads on iOS
This has me stumped. I'm trying to read a 6MB CSV file on iOS line by line. I've tried using plain C file pointers and NSInputStream polling but settled on the following which felt the cleanest. All three approaches result in what seems like a…

Josh Kropf
- 21
- 1
0
votes
2 answers
UIImage from NSInputStream
I'm downloading a 2400x1600 image from Parse and I don't want it to hold all that data in memory at once. PFFile object from Parse has a convenient method to get NSData as NSInputStream so when the data is finally downloaded I end up with a…

mdonati
- 1,049
- 11
- 24
0
votes
2 answers
How to create a NSInputStream/NSOutputStream pair by accepting a server socket?
I know that you can create a NSInputStream and NSOutputStream pair (toll-free bridged to CFReadStream, CFWriteStream) by opening a TCP client connection using CFStreamCreatePairWithSocketToHost according to the Stream Programming Guide.
How can one…

yonran
- 18,156
- 8
- 72
- 97