On my iOS side, i received a stream of images via NSInputStream. NSMutableData will be containing images in [JPG IMAGE][JPG IMAGE][PNG IMAGE].
Is there any elegant way of getting the images from NSMutableData?
EDIT: Thanks for all the replies. I do not know the start/end of the images. I converted the buffer to NSData and append it to NSMutableData. Do i need to include a delimiter in between the images?
Server(.Net): Continuous sending images, so on the client side (iOS) i will never encounter NSStreamEvent.EndEncountered . Closing the NetoworkStream will throw me ObjectDisposedException was unhandled, cannot access a disposed object (fixing it now)
Client: Does not know when the server has completed sending, all it has is a NSMutableData. (fixing it now) I convert the buffer to NSData and append it to NSMutableData
Basically what i want to achieve is:
1. I press connect on my client (iOS app),
2. Establish connection with the server (.Net)
3. Server create and send images to client
4. Client displays the images.
5. Connect and Disconnect initiated by client.
Update: I got it working via:
1. At server side, after each image sent, i append a delimeter.
2. At client side, i append the data to NSMutableData as usual and check the last few bytes for delimeter. If it matches, i can safely proceed to chunk the NSMutableData by the delimeter.
via that, i am able to receive & display multiple images!