Questions tagged [nsoutputstream]

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

101 questions
2
votes
1 answer

CFStreamCreateBoundPair is writing 4kb data to stream and stream will parse the data which contains start node of xml and it doesnt contain end node

CFStreamCreateBoundPair is writing 4kb data to stream and stream will parser the data which contains start node of xml and it doesnt contain end node.how to write the code and manage the code so that we are writing correct xml data to…
2
votes
2 answers

Using NSOutputStream to POST to url

So all I want to do is send a POST request to a url. Now I tried using NSURLRequest/NSURLConnection, but was having problems with that and decided to move to a lower level, also because I want to send large files and thought dealing directly with…
Katie
  • 253
  • 1
  • 3
  • 13
1
vote
1 answer

Delimit data (JSON) with newline when sending to server over socket using NSOutputStream

I'm making a TCP protocol where an app sends JSON to a server and it sends JSON back. I am trying to delimit each transmission with a newline. This is fine on the server side, but how do you add a newline to each NSOutputStream write? The streams…
Jon Cox
  • 10,622
  • 22
  • 78
  • 123
1
vote
1 answer

NSInputStream in background thread doesn't call NSStreamEventHasBytesAvailable

I am working on streaming part of application. I needed to put streaming process on the background thread that it uses NSinputstream and NSOutputstream . then I send http commands over this streaming channel on the same thread. I receive the…
1
vote
3 answers

How to get NSOutputStream to send or flush packets immediately

I am having an issue with latency when connecting to a bluetooth accessory using the External Accessory Framework. When sending data I get the following custom output in the console: if( [stream hasSpaceAvailable] ) { NSLog( @"Space avail"…
andy k
  • 111
  • 2
  • 5
1
vote
0 answers

Swift: Read/Write & connection problems with I/O streams and URLSessionStreamTask

Context I am trying to create a communication channel based on Bonjour NetService and URLSessionStreamTask to open the I/O stream. I have the setup ready and I am able to connect with bonjour service and open I/O streams between mac and iOS app. I…
Jasveer Singh
  • 354
  • 3
  • 10
1
vote
2 answers

Memory issue while converting big video file path to NSData. How to use InputStream/FileHandle to fix this issue?

I have a large sized video saved in my documents directory. I want to retrieve this video and remove it's first 5 bytes. For large video files of above 300 MB using [NSData(contentsOf: videoURL)] causing Memory issue error. I have gone through…
Sona
  • 394
  • 3
  • 15
1
vote
1 answer

(NS)StreamDelegate - no error when writing to closed

When writing to file using OutputStream, after that stream has been closed, there is no error, it silently fails to write. Starting: self.outputStream = OutputStream(toFileAtPath: filePath, append: true) self.outputStream.delegate =…
bauerMusic
  • 5,470
  • 5
  • 38
  • 53
1
vote
0 answers

InputStream never calls hasBytesAvailable

I'm trying to get iOS devices to discover each other with Bonjour and then connect with InputStream and OutputStream. The devices can connect to each other, but sending bytes from one device's OutputStream will not trigger the "hasBytesAvailable"…
1
vote
0 answers

Not able to create a second stream to the same peer in ios using MPC

Each row of the table will contain a song. When a row is selected. The current streams are closed and new streams are created for the same peers and sent. In the recieving side i detect the duplicate streams from the same peer and replace them in an…
ashwin95
  • 11
  • 1
1
vote
1 answer

NSTimer doesn't work

Main problem I'm implementing bandwidth management for Socket Rocket. To reduce amount of alteration in Socket Rocket I've decided to create subclass of NSOutputStream which will wrap NSOutputStream created for a socket. Concept is quite nice and…
Marek R
  • 32,568
  • 6
  • 55
  • 140
1
vote
1 answer

Best way to send large files via TCP in Cocoa

I'm devising a protocol to be sent via TCP packets that can sometimes send large (video) files between iOS and OSX devices. I've got three questions: 1) What is the maximum size for each TCP packet for good performance? ie: Is it better to get…
1
vote
1 answer

Audio file is partially received in target iPhone from sender using Multipeer Connectivity(Swift 2)

I have opened an Output Stream from the sender iPhone and also implemented an Input (receiving ) Stream in the receiving iPhone. I am able to connect both the devices over the same Wi-Fi network using Multipeer Connectivity and send the data (I…
1
vote
3 answers

iOS how can i perform multiple NSInputStream

My app uses NSInputStream like below: inputStream.delegate = self; [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [readStream open]; and delegate: - (void)stream:(NSStream *)theStream…
Scinfu
  • 1,081
  • 13
  • 18
1
vote
1 answer

Can get NSInputStream data and play video

I'm using NSSInputStream & NSOutputStream to send and receiver data, In server(I named it): open stream to send data to client - (BOOL)openStreams { //NSLog(@"SERVER: Open stream"); [self.delegate callbackMessageFromServer:@"SERVER: Open…
Giang
  • 2,384
  • 2
  • 25
  • 26