Can't get remote host and port after CFStreamCreatePairWithSocketToNetService
Can't get remote host and port after CFStreamCreatePairWithSocketToNetService
- Subject: Can't get remote host and port after CFStreamCreatePairWithSocketToNetService
- From: Jeff Johnson <email@hidden>
- Date: Mon, 13 Apr 2015 10:31:17 -0500
I'm using CFStreamCreatePairWithSocketToNetService to get read/write streams. According to the documentation, "The streams do not create a socket, resolve the service, or connect to the service’s host until you open one of the streams." I open the streams with CFReadStreamOpen and CFWriteStreamOpen. The streams are open and can be read from and written to. Yet I can't get the remote host and port from the API. I try CFNetServiceGetTargetHost and CFNetServiceGetPortNumber on both my original CFNetServiceRef and kCFStreamPropertySocketRemoteNetService, but I always get NULL and 0. I try to get kCFStreamPropertySocketRemoteHostName and kCFStreamPropertySocketRemotePortNumber from both the read stream and the write stream, but again I always get NULL.
Isn't this supposed to work? Isn't the net service supposed to resolve when you open the streams?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden