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

Cocoa Socket Programming NSInputStream read returns 0

In my App, have setup the stream like this, (void)connectStream:(NSString *)pHostName PortNo:(int)inPortNo HasInput:(bool)bInput HasOutput:(bool)bOutput{ NSHost *host = [NSHost hostWithName:pHostName]; //host = [NSHost…
Amitg2k12
  • 3,765
  • 10
  • 48
  • 97
0
votes
2 answers

Can't Connect Error Message - iPhone

I have an iPhone application that relies heavily on communicating with an external server. How can I throw an error message when the connection to the server cannot be made or the connection is lost? I have two connections, one is a HTML Post and…
Baub
  • 5,004
  • 14
  • 56
  • 99
0
votes
1 answer

how to use NSStream class to create tcp connection iPhone

I need to send a string to a server on the same network with the iPad. when reading This I found out that maybe I need to use the + getStreamsToHost:port:inputStream:outputStream: method but I am not able use it. In xcode I have tried: //Try…
Tono Nam
  • 34,064
  • 78
  • 298
  • 470
0
votes
1 answer

iphone function of istream and ostream

can anyone tell me the funcion of istream and ostream in the following code and how can i declare istream and ostream as i hv picked the code from net m not having much knowledge about the code NSString *urlStr = @"192.168.178.26"; if (![urlStr…
Junior Bill gates
  • 1,858
  • 4
  • 20
  • 33
0
votes
1 answer

NSOutputStream, how to output data properly after the NSStreamEventHasSpaceAvailable event has passed?

I add messages I want to send to a server to a queue: typedef struct StreamOutputQueue{ char message[513]; struct StreamOutputQueue * next; } StreamOutputQueue; When I get the event NSStreamEventHasSpaceAvailable I send the first message in…
Matthew Mitchell
  • 5,293
  • 14
  • 70
  • 122
0
votes
0 answers

nativescript: Property 'write' does not exist on type 'NSOutputStream'. ts(2339)

I'm missing something. I need to write a text file for ios using NSOutputStream. I create the file import { knownFolders, Folder, File } from "tns-core-modules/file-system"; const folder: Folder=knownFolders.documents(); let outFOS:…
0
votes
1 answer

TCP socket setting in Objective C

I find a method like setReceiveBufferSize() in Java on Objective C. I use NSStream for TCP connection but there is no method of any kind of like that. If you know how to set a socket in IOS please comment for me!
user9569731
0
votes
0 answers

Main Thread blocking NSStream when checking if input is available on NSStream

I am working with a package called DSBridge to connect a mobile application (iOS code in this case) to javascript code containing the main logic of my application. This involves running the JavaScript on an invisible WKWebView. My JavaScript code…
saxford
  • 23
  • 5
0
votes
1 answer

Using system proxy in NSStream

I'm using [NSStream getStreamsToHost:port:inputStream:outputStream:] to create a new stream to a web server to stream generated data on the fly. How would I go about setting up the NSStream to use the system HTTP proxy like NSURLConnection does? I…
JWood
  • 2,804
  • 2
  • 39
  • 64
0
votes
0 answers

What is the best way to store large file data into Coredata in iOS

I am trying to store 30k users details in to core data. To achieve this I search and came up with a solution to have all the data in a file in CSV format. I am able to download and read CSV file to using following code: func readCsvFile () { if…
Sagar In
  • 591
  • 1
  • 4
  • 8
0
votes
1 answer

iPhone control an app from another iPhone

I have a request from a client to do an Enterprise app. The app itself is fairly straight forward, but they want user to be able to request help from admin. When right are granted, Admin will be able to controller the user app from his/her app. I…
Suwitcha Sugthana
  • 1,301
  • 2
  • 11
  • 18
0
votes
0 answers

How to create a custom websocket client in iOS, to send and receive JSON data?

I wanted to connect to a server, ws://12.526.712.67:8000/joker and was told to establish a connection, and check for success message, using WEBSOCKETS.Then I had to post a JSON data along with the next request and get a JSON response as a result of…
swiftDevStart
  • 81
  • 3
  • 11
0
votes
1 answer

How to connect to wss socket where host name has additional path using NSStream?

I'm trying to connect to wss socket, and the host name looks like this: "myhostname.com/ws/v2". Here is how I start the connection: let host = "myhostname.com/ws/v2" CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, host as CFString, 443,…
almas
  • 7,090
  • 7
  • 33
  • 49
0
votes
1 answer

Twitter Streaming API - Objective-C

I am working with the Twitter REST/Streaming APIs. When I want to access the REST API, I create a NSMutableURLRequest (that contains parameters such as access tokens and queries). I then use the request in conjunction with NSURLSession to load the…
Supertecnoboff
  • 6,406
  • 11
  • 57
  • 98
0
votes
0 answers

NSStream for swift works on simulator but not iphone

This code works on the simulator, but not on my iphone with ios 10.3.1. It is connecting to a python client. // // ViewController.swift // 1st robot app // // Created by Tristan Chandraratna on 13/2/17. // Copyright © 2017 Tristan Chandraratna.…
Doggy G
  • 31
  • 1
  • 4