It seems to work fine except for one particular edge case I found where the last message is never received . or processed.
I went into the code and I changed the read buffer size, and it worked ( in the - (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode method) .
Code: Select all
NSInteger len = 0;
len = [(NSInputStream *)stream read:buf maxLength:1023];
Note: it is normally 1024
So now is this a possible bug in the client code? Perhaps the packet handling logic doesn't account for some edge case where the packet length is XXX bytes or so?
Or is there something I'm doing wrong on the server side of things that could be causing this.