Re: Problems with CFSocket and CFStream
Re: Problems with CFSocket and CFStream
- Subject: Re: Problems with CFSocket and CFStream
- From: Jeremy Wyld <email@hidden>
- Date: Tue, 18 Nov 2003 13:37:11 -0800
On Nov 18, 2003, at 8:24 AM, Martin Bestmann wrote:
1)
CFReadStreamCopyProperty(xReadStream,kCFStreamPropertyShouldCloseNative
Socket) returns always NULL
kCFStreamPropertyShouldCloseNativeSocket is a "set" property only.
Possible oversight on my part?
2)
CFReadStreamCopyProperty(xReadStream,kCFStreamPropertySocketRemoteHostN
ame) returns always NULL
This property only returns non-null if the stream had been created with
a named host. I believe what you want is to copy out the native
socket, get its peer address, create a CFHost from that, and then
perform the reverse lookup (if you need the name).
3) After closing the streams with CFReadStreamClose and
CFWriteStreamClose and also closing the socket with CFSocketInvalidate
and quitting app on next launch of the app (within the next few
seconds) we get an error when calling
CFSocketCreateWithSocketSignature because of the fact that the system
for some reason things that the socket is still occupied.
Make sure to
int yes = 1;
setsockopt(<native socket>, SOL_SOCKET, SO_REUSEADDR, (void*)&yes,
sizeof(yes));
See Server.c in /Developer/Examples/Networking/Echo/
jeremy
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.