nsstream

iOS8 AVAudioEngine how to send microphone data over Multipeer Connectivity?

爱⌒轻易说出口 提交于 2019-12-19 03:22:29
问题 I want to send microphone audio data over Multipeer Connectivity (iOS 8) and play it through the speaker of the receiving peer. I've also setup the AVAudioEngine and I can hear the microphone data from the (upper) speaker output, but I don't know how to send AVAudioPCMBuffer over the network. Here's my code snippet: AVAudioInputNode *inputNode =[self.engine inputNode]; AVAudioMixerNode *mainMixer = [self.engine mainMixerNode]; [self.engine connect:inputNode to:mainMixer format:[inputNode

Problem with NSStream SSL Connection

放肆的年华 提交于 2019-12-18 06:23:12
问题 I am using NSStream with SSL property for socket connection. It works fine when I use the local IP address such as 192.168.1.77. But if I use any server like www.xyz.com (it has SecurityLevelTLSv1), it shows an error error code:-9843, Message:Operation could not be completed. (NSUnknownErrorDomain error -9843.) Here is my code: -(void) startSocket{ NSURL *website = [NSURL URLWithString:@"www.xyz.com"]; NSHost *host = [NSHost hostWithName:[website host]]; if(host) { NSLog(@"Valid host");

NSStream SSL on used socket

戏子无情 提交于 2019-12-18 01:19:26
问题 I am writing an application that uses NSStream's SSL functions on the iphone. I know that SSL is working because I can directly connect servers using SSL. I have encountered a problem where protocols that use starttls require me to communicate on the socket with unsecured, send the starttls command and then reuse the same socket for SSL. As far as i know nsstream connections cannot be reused and i can't start SSL on them after i have opened the connection. I thought about creating my own

IOS Stream Socket

依然范特西╮ 提交于 2019-12-14 03:04:38
问题 I am working about socket using Stream I used this code to connect to my server: - (void)initNetworkCommunication { CFReadStreamRef readStream; CFWriteStreamRef writeStream; CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"host", port, &readStream, &writeStream); inputStream = (__bridge NSInputStream *)readStream; outputStream = (__bridge NSOutputStream *)writeStream; [inputStream setDelegate:self]; [outputStream setDelegate:self]; [inputStream scheduleInRunLoop:[NSRunLoop

What is the iOS equivalent to Android Socket programming code?

孤街醉人 提交于 2019-12-13 11:26:48
问题 I have some socket programming code in Android (Java) and I want to implement the same thing in iOS (Objective-C). On iOS, NSStream , NSInputStream , NSOutputStream are some of the classes for socket programming. I have doubts when comparing them to some methods on Android's SocketChannel class. socketChannel.configureBlocking socketChannel.setSoTimeout socketChannel.connect socketChannel.finishConnect socketChannel.isConnected What are the equivalent methods in iOS classes like NSStream ,

performSelector:OnThread:waitUntilDone not executing the selector all the time

徘徊边缘 提交于 2019-12-12 05:58:18
问题 I have an app where the network activity is done in its separate thread (and the network thread continuously gets data from the server and updates the display - the display calls are made back on the main thread). When the user logs out, the main thread calls a disconnect method on the network thread as follows: [self performSelector:@selector(disconnectWithErrorOnNetworkThread:) onThread:nThread withObject:e waitUntilDone:YES]; This selector gets called most of the time and everything works

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

喜你入骨 提交于 2019-12-12 02:25:48
问题 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: [self.inputStream setDelegate:self]; [self.outputStream setDelegate:self]; [self.inputStream scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; [self.outputStream scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];

NSURLSession Background File Upload using Bound Streams

走远了吗. 提交于 2019-12-12 01:59:40
问题 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 of Streams as depicted in this Apple Sample. Now, I wish to follow similar approach with NSURLSession(Background Session) by using uploadTaskWithStreamedRequest :. I have written a small stand-alone iOS Sample + a PHP server to validate my concept.

NSStream closing and opening error

梦想的初衷 提交于 2019-12-11 19:27:06
问题 I'm working with NSStream to send and receive single characters over a network connection. I instantiate the streams both for reading and for writing using CFStreamCreatePairWithSocketToCFHost(...) . The basic working mechanism to send and receive is working fine. Now I want to create the NSStream only when I need to send or receive something (usually one time every 2 minutes). The first time I create the streams, send the packet, close it and everything work well. Next I try to recreate the

Convert a multi-byte unicode byte array into an NSString, using a partial buffer

▼魔方 西西 提交于 2019-12-11 10:03:14
问题 In Objective C is there a way to convert a multi-byte unicode byte array into an NSString, where it will allow the conversion to succeed even if the array data is a partial buffer (not on a complete character boundary)? The application of this is when receiving byte buffers in a stream, and you want to parse the string version of the data buffer (but there is more data to come, and your buffer data doesn't have complete multi-byte unicode). NSString's initWithData:encoding: method does not