Questions tagged [nsoutputstream]

The NSOutputStream class is a subclass of NSStream that provides write-only stream functionality.

101 questions
12
votes
4 answers

Writing Data to an NSOutputStream in Swift 3

The solution of this question no longer works with Swift 3. There is no longer a property bytes of Data (formerly NSData. let data = dataToWrite.first! self.outputStream.write(&data, maxLength: data.count) With this code, I get the error: Cannot…
ahyattdev
  • 529
  • 1
  • 6
  • 18
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
8
votes
1 answer

Get NSData from an NSOutputStream in memory?

I want to use an NSOutputStream to accumulate data, then when finished, create an NSData object with the contents. I can do it when the output stream is based on a file, as follows: NSString *tmpDirectory = NSTemporaryDirectory(); NSString…
joseph.hainline
  • 24,829
  • 18
  • 53
  • 70
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
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

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
0 answers

NSInputStream's NSStreamEventHasBytesAvailable never gets called

I am creating an app similar to WiTap (but to connect many devices) and here is my problem: The application seems to connect the devices (they are displayed in table view controller. The delegate of NSInput/OutputStream says both streams are opened…
ipek
  • 41
  • 4
3
votes
1 answer

Tunneling web requests on iPhones

I want to know if it is possible to tunnel web requests, and of course what to use/implement. I have already written subclasses of NSInputStream and NSOutputStream to send & receive data via my custom proxy server, which is working wonderfully for…
Pada
  • 646
  • 5
  • 13
3
votes
0 answers

ios - NSOutputStream doesn't write data

I am downloading a file and writing its bytes to an NSOutputStream: self.outputFileStream = [NSOutputStream outputStreamToFileAtPath:downloadFilePath append:NO]; [self.outputFileStream setDelegate:self]; Then, in a NSURLSession's…
annaoomph
  • 552
  • 1
  • 4
  • 22
3
votes
3 answers

iOS : NSInputStream / NSOutputStream - CFNetwork SSLHandshake failed (-9806)

I'm trying to open an input/output stream to a secure server but keep getting CFNetwork SSLHandshake failed (-9806) I have set the plist values for exception domains etc NSAppTransportSecurity NSExceptionDomains
Zigglzworth
  • 6,645
  • 9
  • 68
  • 107
3
votes
0 answers

Can't write to NSOutput Stream in Swift

Since last week I'm developing an App using Swift. This is my first time working with swift and now I'm struggeling for the first time. I have to use the ExternalAccessory framework an for that I want to connect to a device and write Data into an…
kamischu
  • 61
  • 3
3
votes
1 answer

Scheduling stream on NSRunLoop

I have been following this tutorial http://www.raywenderlich.com/3932/networking-tutorial-for-ios-how-to-create-a-socket-based-iphone-app-and-server and I got everything working ok, but there is one line in text that I don't understand: Our streams…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
3
votes
1 answer

iOS: NSFileHandle vs NSOutputStream for large file download

On iOS, our application is downloading a zip file that's approximately 400MB. We're getting intermittent crashing while the file is downloading. Current I'm using [NSFileHandle writeData:] to write the data as it comes in, and is not being stored in…
gngrwzrd
  • 5,902
  • 4
  • 43
  • 56
2
votes
1 answer

Do the stream classes in Cocoa support seeking?

I need a Cocoa class that can read and write from a memory stream and that supports seeking. In C#, MemoryStream supports the method seek, and in Java, ByteArrayInputStream supports the methods mark, skip, and reset. In iOS development, what are the…
Lopper
  • 3,499
  • 7
  • 38
  • 57
1
2 3 4 5 6 7