CFReadStream & CFWriteStream callbacks not received.

Originator:lalitpatil2007
Number:rdar://40056977 Date Originated:8 May 2018
Status:Open Resolved:
Product:CFNetwork Framework Product Version:10.3.2
Classification: Reproducible:Always
 
Area:
CFNetwork Framework

Summary:
I want to use cellular data when WI-FI is On. For that, I need access to socket before it is connected so that it can be bound to cellular network IP and port.  Thought of using CFStreamCreatePairWithSocket() instead of CFStreamCreatePairWithSocketToHost() but stream callbacks are not received.

Steps to Reproduce:

1.	Create TCP socket with CFSocketCreate() function 
2.	Get a native socket using CFSocketGetNative() and bind it to cellular IP.
3.	Make a connection using CFSocketConnectToAddress() with timeout 
        parameter as -1 (Need a non-blocking connect).
4.	Scheduled it over run loop. 
5.	Upon kCFSocketConnectCallBack call back event create streams using 
         CFStreamCreatePairWithSocket(). 
6.	Assigns a clients to a streams for stream events.
7.	Scheduled streams over run loop and opened the stream.

Expected Results:
1. Receive socket call back events.
2. Receive stream call backs events.

Actual Results:
1. Received kCFSocketConnectCallBack once and kCFSocketWriteCallBack twice. Rest events are not received.
2. Received only kCFStreamEventOpenCompleted.

Version/Build:
10.3.2

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!