Reputation: 33445
I have a problem with CFSocketSetAddress()
. The first time I call it, it works just fine.
If I clean up everything associated with the socket and attempt to open it again on the same port I get a CFSocketError
of -1 (kCFSocketError
- very descriptive).
I'm presuming I didn't clean up the previous socket correctly. I'm cleaning up all the FileDescriptors and calling CFSocketInvalidate
and CFRelease
on the CFSocketRef
. Is there anything else I need to do to clean up the existing socket so that the socket can be reopened?
Upvotes: 1
Views: 1203
Reputation: 33445
Ok this always happens. Post to StackOverflow and then figure it out about 5 mins later.
Answer: I needed to call closeFile on the NSFileHandle
associated with the socket.
Upvotes: 1