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
1 answer

Reading from and writing to NSStream in/out handle by single thread design

I would like to make a tcp listener class that should handled by a single thread ie all io operations should be carried out by a single thread. Trigger an event when a message is arrived to inputStream and multiple thread can add a task to listener…
user2067201
  • 258
  • 1
  • 13
0
votes
0 answers

iOS TCP performance (NSStream)

I'm writing an iOS application that handles a lot of TCP traffic (over WiFi). Here's my scenario, all writes/reads are done on the dispatch queue QOS_CLASS_UTILITY. Send request for data packet (~20 bytes) Receive data packet (~100-64k bytes),…
Tomasz Wójcik
  • 955
  • 10
  • 23
0
votes
1 answer

Swift NSStream sending multiple distincts commands

I need to get the status of a list of devices from my home automation server. The devices I want to query for are in an array. I'm triyng to loop thru that array, and for each devices, I'm doing a send to the server. The problem I have is that the…
0
votes
1 answer

Connect to multiple servers at the same time using sockets in NSStream

I am creating a socket based iOS app using Objective-C, now my requirement is to connect to two servers at the same time. I am using NSInputStream and NSOutputStream and I am able to connect to the first server as well as send and receive data with…
Saad Umar
  • 604
  • 1
  • 8
  • 17
0
votes
1 answer

Problems in getting data from CFStreamCreatePairWithSocketToHost

I'm building an iPhoe app with a socket to a PC app , I need to get an image from this PC app. It's my first time using "CFStreamCreatePairWithSocketToHost".After I establish the socket with "NSOperation" I call CFStreamClientContext streamContext…
gkedmi
  • 61
  • 1
  • 4
0
votes
0 answers

Proxy server persistent connection closing

I'm implementing proxy support for an osx app. I've created a custom NSURLProtocol and it is working perfectly for a proxy without authentication. Tried with both CCProxy and FreeProxy on a Windows computer in the local network. However when proxy…
Templar
  • 1,694
  • 1
  • 14
  • 32
0
votes
0 answers

Can I open my own socket on receiving a silent remote notification on iOS?

Am I allowed to open my own socket to download new data on receiving a silent remote notification on iOS?
evanescent
  • 1,373
  • 13
  • 20
0
votes
1 answer

NSURLSession Background File Upload using Bound Streams

History: I am working on a project for which we need to support: Background Upload of files using NSURLSession. The server expects file to be uploaded using Content-Type: multipart/form-data Previously, I was using NSURLConnection with bound pair…
Taha Samad
  • 1,135
  • 1
  • 9
  • 22
0
votes
0 answers

Multiple NSStreams inside a NSStream, NSNetService with multiple streams

Basically i use NSNetService, which provides you with one i/o stream pair - (void)netService:(NSNetService *)sender didAcceptConnectionWithInputStream:(NSInputStream *)inputStream outputStream:(NSOutputStream *)outputStream I need to use however…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
0
votes
0 answers

Creating NSStream from dispatch_io_t

How do i create a NSStream from a dispatch_io_t? /*! * @typedef dispatch_io_t * A dispatch I/O channel represents the asynchronous I/O policy applied to a * file descriptor. I/O channels are first class dispatch objects and may be * retained and…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
0
votes
1 answer

NSInputStream:read:maxLength: on a TCP socket stream returns the error "The operation couldn’t be completed. Bad file descriptor"

I am trying to wrap my head around making a simple TCP server in Xcode, Objective-C on OS X. It seems like the connection is accepted, and I am getting all the events that I am supposed to get through the event handling, but when I try to read from…
RoyGal
  • 176
  • 7
0
votes
0 answers

Custom SSL Authority NSStream swift

Key points: Client: Swift with NSStream looped event Server: Python twisted custom protocol Currently to connect to my server, i need to import my SSL signing authority into the apple key chain along with the public key. i want to bypass all of the…
nsij22
  • 869
  • 10
  • 20
0
votes
1 answer

NSStream check for error transmission, altered data

I use NSStream to send data over through MCSession, this works fine 99%, however sometimes i get trash on the receiver's end I write First 4 bytes is the hash Next 4 bytes is the content length Rest the data in case of trash, i get wild values like…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
0
votes
2 answers

Knowing that data from an NSStream is complete

I'am sending chunks of UIImage data over MCSession with an NSStream. When I get bytes - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode { if (eventCode == NSStreamEventHasBytesAvailable) { // read data and append to…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
0
votes
1 answer

When should you call NSXMLParser.parse() on your NSStream?

I have a NSXMLParser object. I'm running an XMPP stream. Does .parse() need to be called each time I receive a message or just once? Here's a parse of relevant code in the NSStream: func connectToSocket(host: String, port: Int) { …
user83039
  • 3,047
  • 5
  • 19
  • 31