nsinputstream

How to signal an NSStreamEventEndEncountered on an NSInputStream reading from NSMutableData.

In Cocoa, I've setup two NSThreads, one producer and one consumer. The producer appends data to an NSMutableData, and the receiver opens an NSInputStream from that data and reads in chunks. The producer thread writes a lot faster than the consumer processes, which is OK. But the producer only produces a finite amount of work, then exits...

Class NSURLRequest. Method - (NSInputStream *)HTTPBodyStream always returns nil. Why?

I am trying to use NSURLRequest with NSURLConnection to establish a binary stream connection to an HTTP server to retrieve a humungous data file in small, incrementally pieces. I see the method - (NSInputStream *)HTTPBodyStream on NSURLRequest. Is that the method I want to call on my instance of NSURLRequest? If so why does it alway ret...

What Am I Missing? : iPhone Objective-C NSInputStream initWithData

I'm creating an NSInputStream from an NSData object but once created the stream reports NO for hasBytesAvailable: NSData* data = [outputStream propertyForKey: NSStreamDataWrittenToMemoryStreamKey]; NSLog(@"creating stream with data 0x%x length %d", [data bytes], [data length]); NSInputStream *insrm = [[NSInputStream alloc] initWithDat...

Buffer overflow or Race Condition with multiple NSInputStream, NSOutputStream and NSURLConnection?

Hi, I have a strange problem with some multiple input/output streams and NSURLConnection: First I open each one NSInputStream and NSOutputStream. They are communicating with a socket connection. After some communication I open a second socket connection. After that I need to connect to a web server by using NSURLConnection. After the c...

Streaming JPEGs, detect end of JPEG

I have created a java server, which takes screenshots, resizes them, and sends them over TCP/IP to my iPhone application. The application then uses NSInputStream to collect the incoming image data, create an NSMutableData instance with the byte buffer, and then create a UIImage object to display on the iPhone. Screenshare, essentially....

Cocoa Read NSInputStream from FTP connection

Hi, 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 *oStream; implementation: NSHost *host = [NSHost hostWithAddress:@"127.0.0.1"]; [iS...

Uploading XML with NSInputStream Iphone....

Hi, I have to upload XML string to server & the Web service expect it in body stream part of the http request. So i am allocating the NSInputstream instance with xml data & then setting it the part of the http string but it uploading the stream body NULL & in my code if check the Stream status, it gives error & size null, Could you let m...

Processing potentially large STDIN data, more than once

I'd like to provide an accessor on a class that provides an NSInputStream for STDIN, which may be several hundred megabytes (or gigabytes, though unlikely, perhaps) of data. When a caller gets this NSInputStream it should be able to read from it without worrying about exhausting the data it contains. In other words, another block of co...

NSDictionary into a NSInputStream

Hi there Is it possible to put in my NSDictionary into a NSInputStream? This would be my NSDictionary NSArray *keys = [NSArray arrayWithObjects:@"name", @"device_token", @"identifier", nil]; NSArray *values = [NSArray arrayWithObjects:@"Test iPhone", initDeviceToken, [UIDevice currentDevice].uniqueIdentifier, nil]; NSDictionary *parame...

Methods to render a PDF into a very high resolution NSImage bitmap file

Hi, I have to render a PDF into a very high resolution image (say up to and even over 100,000 * 80,000 pixels). I managed to do that without going out of ram by splitting the render into several slices and then rendering each one using NSOperationQueue, basically drawing the NSImage pdf representation into a new NSImage using drawInRect...

NSInputStream getBuffer: length: doesn't work?

Hi there, I really would like to use the getBuffer:length: method of an NSInputStream. After a lot of research i couldn't find a valid example that uses this method, because most people really needed read: maxLength:. So now some facts on the surroundings: * I'm developing an app for the iPhone, iOS 3.1.3 * I've established a network c...