Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

socket closed by remote peer gcdasyncsocket

Creating an chat application using xmppframework. When ever I try to connect to the server it connects & disconnected immediately & throws the following error.

error domain=gcdasyncsocketerrordomain code=7 socket closed by remote peer

It happens the same on Adium (chat app) software. Wondering any thing set wrong while setupping the Openfire on AWS Server.

https://community.igniterealtime.org/thread/50643

Please let me know If I need to follow any steps or such.

Thanks for reading.

like image 301
Anand Avatar asked Oct 30 '22 05:10

Anand


1 Answers

You must store the new socket when the delegate method socket:didAcceptNewSocket been invoked

@property (nonatomic, strong) NSMutableArray *socketsArray;

- (void)viewDidLoad {
    _socketsArray = [[NSMutableArray alloc] init];
}

- (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket {
    [_socketsArray addObject:newSocket];
}
like image 60
Teson Draw Avatar answered Nov 15 '22 07:11

Teson Draw