I've got an interesting issue with my socket test application.
I've set up a listening socket with an AcceptCallback function. I've connected to the listening socket using :
CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault,
(CFStringRef) self.clientService.hostName,
self.clientService.port,
&myReadStream,
&myWriteStream);
and I've send data back to the listening socket the myReadStream and myWriteStream, both of which I've cast to their NSStream equivalents.
The problem occurs after sending many separate packets of data. The size of the packets do not matter, it's the number of packets (or the number of CFStreamCreatePairWithSocketToHost creations) that seems to introduce the error.
After I send tons of packets (maybe around 100 or 200), when I try to send data over the NSOutputStream I get an error in the NSStreamEvent callback:
Operation could not be completed. (NSUnknownErrorDomain error 8.)
Then, if I try to create a new service and publish it on the network I get an error when I try to resolve the new address. It gives me an error code of 10 in the NSNetService:didNotResolve delegate method (also, the error description is blank here).
It's almost as if the listening socket is "full" but it seems to think it's functioning fine because when I check CFSocketIsValid it returns true.
I'm stumped and have spent several hours trying to debug the situation... Any thoughts anybody? Thanks.