当应用程序正在运行iOS4的SIGPIPE错误的背景和锁屏 [英] SIGPIPE error in iOS4 when app is running background and lock screen

查看:261
本文介绍了当应用程序正在运行iOS4的SIGPIPE错误的背景和锁屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用BSD套在我的应用程序发送和接收的iPhone4(的iOS4.1)的数据,也有我的应用程序三种情况:

I use BSD socket in my app to send and receive data on iphone4(iOS4.1),there are three situations in my app:


  1. 应用程序在前台和屏幕锁运行,它的罚款。

  2. 应用程序在后台运行和屏幕锁简化版,,那也没关系(我用NSStream在后台发送和接收Keep应用活着的数据,它工作正常。)

  3. 的应用程序在背景和屏幕锁定运行,应用程序运行良好,但总是能得到SIGPIPE错误,当应用程序试图调用的sendto()或发送()通过UDP或TCP套接字。

我搜索了很多,但什么也得不到有用的,从这里 我知道什么是SIGPIPE,我使用的setsockopt(袜子,SOL_SOCKET,SO_NOSIGPIPE,(无效*)及上的sizeof(int)的),以避免应用程序异常退出。但我仍然不知道为什么只有在情况3,如何通过通常在这种情况下BSD套接字发送数据时发生此错误。

I search a lot but get nothing useful,from here i know what SIGPIPE is , and i use setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (void *)&on, sizeof(int)) to avoid app exit abnormally. but i still don't know why this error occurred only in situation 3 and how to send data normally through bsd socket in this situation.

我必须尝试恢复和重新连接,但它简化版,工作,但仍然得到SIGPIPE错误。
  我想这也许是所有BSD套接字无法获得的情况3的内部访问(据我们知道,BSD套接字无法激活WiFi或EDGE连接iOS中),任何人都可以帮助我或者给我一些建议吗?和对不起我的蹩脚英语^。^,非常感谢你。

I have try to renew and reconnect but it does't work,it still get SIGPIPE error. I think it maybe that all BSD sockets cannot get internal access in situation 3(As far as we know that BSD socket cannot activate wifi or EDGE connection in iOS),Anyone can help me or give me some suggestions? and sorry for my Broken English^.^,Thank you very much .

推荐答案

我在谷歌搜索,发现我自己的问题前10个月,这很有趣。
我已经为应用的解决方案保持后台运行,并调用setsockopt(袜子,SOL_SOCKET,SO_NOSIGPIPE,(无效*)及上的sizeof(INT))是有用的,这将忽略SIGPIPE 13误差

I search on google and found my own question 10 months before, that's interesting. I already had a solution for application keep running in background , and setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (void *)&on, sizeof(int)) is useful which will ignore Sigpipe 13 error .

这个错误发生在插座已经失去了物理连接,仍然尝试写数据,通过WIFI,3G或附件。

this error happens when the socket already lost physical connection and still try to write data,through Wifi, 3G or Accessory.

这篇关于当应用程序正在运行iOS4的SIGPIPE错误的背景和锁屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆