Ios 远程对等gcdasyncsocket关闭的套接字
使用xmppframework创建聊天应用程序。当我尝试连接到服务器时,它会立即连接并断开连接并抛出以下错误Ios 远程对等gcdasyncsocket关闭的套接字,ios,iphone,sockets,openfire,xmppframework,Ios,Iphone,Sockets,Openfire,Xmppframework,使用xmppframework创建聊天应用程序。当我尝试连接到服务器时,它会立即连接并断开连接并抛出以下错误 error domain=gcdasyncsocketerrordomain code=7 socket closed by remote peer 在Adium(聊天应用程序)软件上也会发生同样的情况。想知道在AWS服务器上设置Openfire时是否设置错误 请让我知道,如果我需要遵循任何步骤或诸如此类 感谢阅读。请查看此github链接 这是因为服务器可能由于空闲时间而关闭连接
error domain=gcdasyncsocketerrordomain code=7 socket closed by remote peer
在Adium(聊天应用程序)软件上也会发生同样的情况。想知道在AWS服务器上设置Openfire时是否设置错误
请让我知道,如果我需要遵循任何步骤或诸如此类
感谢阅读。请查看此github链接 这是因为服务器可能由于空闲时间而关闭连接。您需要向服务器发送持续ping 如回答中所说, 服务器关闭连接时有两个原因:
调用委托方法socket:didAcceptNewSocket时,必须存储新套接字
@property (nonatomic, strong) NSMutableArray *socketsArray;
- (void)viewDidLoad {
_socketsArray = [[NSMutableArray alloc] init];
}
- (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket {
[_socketsArray addObject:newSocket];
}