CFSocketSendData silently dropping packets
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com User-agent: Thunderbird 1.5.0.2 (Macintosh/20060308) When ARP resolution is slow, my CFSocketSendData call silently fails to send packets. CFSocketError CFSocketSendData ( CFSocketRef s, CFDataRef address, CFDataRef data, CFTimeInterval timeout ); The socket was created using SOCK_DGRAM. I set the timeout to 0 and then trap the result code. Objective-C code follows: CFSocketError error = CFSocketSendData ( _socket, (CFDataRef) [addr addrAsData], (CFDataRef) data, 0 ); switch (error) { case kCFSocketSuccess: break; case kCFSocketError: [self writeLog: @"Error while sending data to %@", [addr addrAndPortAsString] ]; return false; case kCFSocketTimeout: [self writeLog: @"Send operation timed out" ]; return false; default: [self writeLog: @"Error: Unknown failure condition while sending data to %@", [addr addrAndPortAsString] ]; return false; } I fire off three of these messages in quick succession. If the arp cache is not primed the Mac must perform arp resolution. Sometimes, the arp message takes as long as 1-2 ms to return. In such cases, the first two messages return success (or don't trigger the log messages, in any case) but fail to actually be written to the network. The third message is correctly sent. I would have assumed that either the messages would be sent or that they would get a timeout fail, not that they would be reported as successful and not sent. Can anyone shed some light on my situation? Thanks -- Andrew White -------------------------------------------------------------------------- This email and any attachments may be confidential. They may contain legally privileged information or copyright material. You should not read, copy, use or disclose them without authorisation. If you are not an intended recipient, please contact us at once by return email and then delete both messages. We do not accept liability in connection with computer virus, data corruption, delay, interruption, unauthorised access or unauthorised amendment. This notice should not be removed. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Andrew White