I feel like I'm doing this wrong, or it's just a result of my novice with sockets. I'm using asyncSocket on the iPhone to send data to node.js. My problem is that every so often, the app will hang, and then I'll get like 5 or 10 messages at once in one data read, rather than separate, more timely reads.
Is this a network hiccup and the data backed up or is this node.js trying to be smart on my behalf and group together very quick messages? Is there something I can send on the iPhone side to say "this is the end of my message, stop waiting for more data" so I can be sure it's a network issue? I feel like there should be a termination character, like asynsocket uses new lines, but I can't seem to make that work with node.
It's much more important to me that the data arrives quickly than anything else.
Thanks!
EDIT: been trying to use 0xFF but I'm not sure I'm doing that right, and I don't have anything to test against, so I have no way to know.
...
[asyncSocket writeData:data withTimeout:-1 tag:0];
NSData* term = [NSData dataWithBytes:"\xFF" length:1];
[asyncSocket writeData:term withTimeout:-1 tag:0];