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

TCP Sockets not working on iPhone 7 running iOS 10.3.2

I am creating an app that communicates with an external service via a TCP Socket (NSStream). I am running into an issue on an iPhone 7 running iOS 10.3.2 whereby the NSStream is congested and messages can't send fast enough for my app to react.…
mhorgan
  • 886
  • 2
  • 11
  • 32
0
votes
1 answer

Asynchronous NSStream I/O with GCD

I am working with an external device that I receive data from. I want to handle its data read/write queue asynchronously, in a thread. I've got it mostly working: There is a class that simply manages the two streams, using the NSStreamDelegate to…
Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
0
votes
0 answers

IPV6 wifi vs cellular

I am a little confused about some aspects of IPv6 if anyone know a bit more than me please fill me in. First off I use host names with the NSStream class so my app should be IPv6 compliant is this right? As NSStream should try to connect to the DNS…
Charlie
  • 222
  • 3
  • 20
0
votes
0 answers

Check if delegate method was called

I have following function for connecting to a TCP Socket (Server on a Raspberry Pi, which I directly connect to via Access Point) func connect (host: String, port: Int) { Stream.getStreamsToHost(withName: addr, port: port, inputStream:…
Daniel Gretzke
  • 426
  • 4
  • 19
0
votes
0 answers

Swift 3 ViewDidLoad and NSStream;

is it possible to create sockets inside of ViewDidLoad? I created a NSStream socket inside here, opened it, wrote to it, closed and it hangs I need to send data with UI interactions; how can I do this? It this an asynchronous or synchronous…
humblebeast
  • 303
  • 3
  • 16
0
votes
1 answer

iOS: App is hanging when trying to close the stream

I created NSStreams to transfer something using the below code: dispatch_async(dispatch_get_main_queue(), ^{ // open input [self.inputStream setDelegate:controller]; [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop]…
Xin
  • 47
  • 7
0
votes
1 answer

NSStreams-code works as expected just in the debugger mode

Everything work as expected just step-by-step throw debugger, otherwise I'm getting EXC_BAD_ACCESS. I guess that I need a delay somewhere or waiting(preferable) for something. // 1) Create streams(input/output) Stream.getStreamsToHost(withName:…
danilabagroff
  • 602
  • 1
  • 7
  • 23
0
votes
1 answer

How to use a self generated ssl cert with NSStream(s) in Swift

I have a python server in the cloud that accepts socket requests. I have a Swift (xCode) client application that uses NS(in/out)putstreams to communicate with the python server app. I generated my own SSL cert and key files on the server. With the…
0
votes
1 answer

NSOutputStream to know when data has been read in the other side

I'm sending audio from the microphone in realtime from an iOS device to a server. The problem that I have: When it gets disconnected for any reason, I don't know actually how many data has been read in the server. I would like this to be consistent.…
Pablo Martinez
  • 1,573
  • 12
  • 31
0
votes
2 answers

NSData dataWithBytesNoCopy from NSInputStream

I'm working on transcoding image data from a file to a base64 encoded string and then back to bytes as the file is read using NSStream. I think I'm almost there, but I keep running into EXC_BAD_ACCESS at various points during the conversion. I'm…
frsh
  • 103
  • 2
  • 10
0
votes
1 answer

nsoutputstream stuck in status 1(NSStreamStatusOpening = 1) - iOS - objective c

i try to upload an iPod music to ftp server. so using AVAssetExportSession, i make a file at documents folder exportSession.outputURL = [NSURL fileURLWithPath:musicFilePath]; [exportSession exportAsynchronouslyWithCompletionHandler:^{ …
0
votes
1 answer

Writes to NSOutputStream after performing work on background thread don't work

I have a program that is sending large files over NSStreams after some initial processing. The flow of the application goes like this: 1) Two devices connect to each other, open their input and output streams, and schedule their run loops: …
user3062913
  • 353
  • 2
  • 10
0
votes
1 answer

Bonjour/NSNetService Data written to NSOutputStream never makes it to the other side (includesPeerToPeer = true)

I have an iOS app that establish a peer-to-peer connection through Bonjour/NSNetService. (based on the WiTap sample code) In some cases, both devices won’t receive data anymore after a few seconds while they are still able to write data out (i.e.…
0
votes
1 answer

NSLog show strange character instead of the JSON

I have this code below that handles the response send by my server with sockets: uint8_t buffer[4096]; int len; NSMutableString *total = [[NSMutableString alloc] init]; while ([inputStream hasBytesAvailable]) { …
Lacrifilm
  • 253
  • 5
  • 15
0
votes
0 answers

NSInputstream & EventEndOfStream

So this is my issue. A programs writes log files to a specific folder. Once a log file is created it is written to about every 2 seconds until it reaches approx 5MB. A new file is created then. I am Parsi g the log files to gather data real time. I…
Jeff Brown
  • 86
  • 8