• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSInputStream get NSStreamEventEndEncountered without reason
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSInputStream get NSStreamEventEndEncountered without reason


  • Subject: NSInputStream get NSStreamEventEndEncountered without reason
  • From: Kévin Vavelin <email@hidden>
  • Date: Sat, 04 May 2013 22:44:25 +0200

I use SocketIO project on my iOS app to connect to my node.js server and everything works great until I choose to connect to facebook. When I connect to Facebook I send some data to my server and he answer with some data like "user already connected, user created in database" etc. And after that, my NSInputStream seems to be at 0 and so my connexion is closed. I don't know what to do, I spent 14 hours on that and still get this issue...

Can you help me with ?
Looks like the problem is in SRWebSocket.m line 1462

There is the code in fault :

            case NSStreamEventEndEncountered: {
                [self _pumpScanner];
                SRFastLog(@"NSStreamEventEndEncountered %@", aStream);
                if (aStream.streamError) {
                    [self _failWithError:aStream.streamError];
                } else {
                    if (self.readyState != SR_CLOSED) {
                        self.readyState = SR_CLOSED;
                        _selfRetain = nil;
                    }

                    if (!_sentClose && !_failed) {
                        _sentClose = YES;
                        // If we get closed in this state it's probably not clean because we should be sending this when we send messages
                        [self _performDelegateBlock:^{
                            if ([self.delegate respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)]) {
                                [self.delegate webSocket:self didCloseWithCode:0 reason:@"Stream end encountered" wasClean:NO];
                            }
                        }];
                    }
                }

                break;
            }

            case NSStreamEventHasBytesAvailable: {
                SRFastLog(@"NSStreamEventHasBytesAvailable %@", aStream);
                const int bufferSize = 2048;
                uint8_t buffer[bufferSize];

                while (_inputStream.hasBytesAvailable) {

                    int bytes_read = [_inputStream read:buffer maxLength:bufferSize];

                    if (bytes_read > 0) {
                        [_readBuffer appendBytes:buffer length:bytes_read];
                    } else if (bytes_read < 0) {
                        [self _failWithError:_inputStream.streamError];
                    }

                    if (bytes_read != bufferSize) {
                        break;
                    }
                };
                [self _pumpScanner];
                break;
            }

And the result from my server (initalLogin = yes connexion is good you can continue) :

onData 5:::{"name":"initalLogin","args":[{"guid":"af78bdf0-f17d-ede2-7dd6-22708d1330f7","usedWithFaceBook":true}]}

start/reset timeout
NSStreamEventEndEncountered <__NSCFInputStream: 0xab21660>
onDisconnect ()

DECONNEXION = The operation couldn’t be completed. (SocketIOError error -4.)

Can you help me with ?

Thanks in advance.

Vavelin Kévin
Twitter | Blog | LinkedIn
Entrepreneur
Developer OS X / iOS

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSInputStream get NSStreamEventEndEncountered without reason
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Enable Unique Selection
  • Next by Date: What am I looking for in the documentation?
  • Previous by thread: Re: NSDocument saveDocumentWithDelegate deadlocked during App termination
  • Next by thread: Re: NSInputStream get NSStreamEventEndEncountered without reason
  • Index(es):
    • Date
    • Thread