cfstream

How to configure CFStream (or NSStream) for SSL handshake?

断了今生、忘了曾经 提交于 2020-01-22 20:03:29
问题 I'm using CFStream/NSStream to make http connections. I want to be able to detect that a SSL handshake fails for three cases: case A: server is not trusted case B: server is trusted but asks a client certificate case C: server is not trusted and it asks a client certificate Today without doing anithing on the SSL Properties of my CFStream, I get: case A: error -9807 case B: no error but server refuses the connection (error 500) case C: error 9807 Is there a way to configure CFStream to

Upload audio - http streaming

被刻印的时光 ゝ 提交于 2019-12-12 09:25:30
问题 I'm trying to upload a linear file under http in streaming mode. The idea is do this steps simultaneously, 1) Thread 1: record an audio file and store it in a temp file 2) Thread 2: Take n bytes from temp file and send it to an http server. How can I write an http stream?, On CFHTTPStream I did not see write methods, only read :s Do I need use sockets? Thanks!!! My actual code is CFWriteStreamRef stream; NSString *strUrl = @"myurl"; NSURL *url = [[[NSURL alloc] initWithString:strUrl] retain];

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

How to fix leak of SocketStream with service type set to VoIP?

倖福魔咒の 提交于 2019-12-11 07:19:58
问题 Xcode reporting SocketStream object is leaking after streams closing. Leak is reliably reproducible on iPhone, but not on Simulator or Mac. Streams are created with CFStreamCreatePairWithSocketToCFHost , then used, closed and released, leaving another SocketStream every time. I checked retain history in Instruments, and found out that every time read and write streams are closed SocketStream has retain count of 2. (my guess is these two retains are done in

NSStream receive NSStreamEventEndEncountered during opening

烂漫一生 提交于 2019-12-07 13:26:18
问题 I have a client - server app that uses NSStream to connect. sometimes when trying to open a connection, one side of the connection gets NSStreamEventEndEncountered when first trying to send a message. I use the bridge between CFStream and NSStream. My server create a socket with: _ipv4cfsock = CFSocketCreate(kCFAllocatorDefault,PF_INET, SOCK_STREAM,IPPROTO_TCP, kCFSocketAcceptCallBack, handleConnect, &info); In the handleConnect callback function, CFStreamCreatePairWithSocket is used to get

NSStream receive NSStreamEventEndEncountered during opening

别等时光非礼了梦想. 提交于 2019-12-05 22:49:25
I have a client - server app that uses NSStream to connect. sometimes when trying to open a connection, one side of the connection gets NSStreamEventEndEncountered when first trying to send a message. I use the bridge between CFStream and NSStream. My server create a socket with: _ipv4cfsock = CFSocketCreate(kCFAllocatorDefault,PF_INET, SOCK_STREAM,IPPROTO_TCP, kCFSocketAcceptCallBack, handleConnect, &info); In the handleConnect callback function, CFStreamCreatePairWithSocket is used to get two CFStream. My client use CFStreamCreatePairWithSocketToHost to connect to the host. The client

Upload audio - http streaming

会有一股神秘感。 提交于 2019-12-04 20:20:08
I'm trying to upload a linear file under http in streaming mode. The idea is do this steps simultaneously, 1) Thread 1: record an audio file and store it in a temp file 2) Thread 2: Take n bytes from temp file and send it to an http server. How can I write an http stream?, On CFHTTPStream I did not see write methods, only read :s Do I need use sockets? Thanks!!! My actual code is CFWriteStreamRef stream; NSString *strUrl = @"myurl"; NSURL *url = [[[NSURL alloc] initWithString:strUrl] retain]; CFStringRef requestMethod = CFSTR("GET"); CFHTTPMessageRef message= CFHTTPMessageCreateRequest