We sending data over UDP from the iPhone, sometimes, but not always, in response to our first send() of UDP data, we are getting back a -1 return code and errno set to 1 (EPERM / operation not permitted). The EPERM result for send(), sendto() and sendmsg() is not documented in the man pages as a return result 开发者_JAVA百科from those functions.
Has anyone out there encountered this and might be able to shed some light on what this errno value means in this context?
A guess: Could it be that there is no wireless/3G connection active, so the network interface(s) are down?
Also note this from the iPhone SDK:
Although BSD (POSIX) networking APIs are available in iPhone OS, you should avoid using them. If you communicate directly with sockets, certain networking capabilities of iPhone OS, such as VPN On Demand, do not work. Use the APIs provided in CFStream Socket Additions instead.
精彩评论