What is the TAG in didReadData ?

72 views
Skip to first unread message

Flo

unread,
Apr 7, 2012, 1:15:47 PM4/7/12
to cocoaasy...@googlegroups.com

Hello mates,

I think I understood the following:

- the tag is just used locally, which means we deal with it ourself.

- we write data in the socket queue then, when data has actually been written,  the didWriteDataWithTag delegate methods is called. So the tag is the one we initially set at first.

But what about the tag that is in the didReadData delegate method ? Since data comes from some other remote peer, what does this tag refer to ?

Thanks a lot!

Flo

Per Jespersen

unread,
Apr 7, 2012, 1:18:29 PM4/7/12
to cocoaasy...@googlegroups.com, Flo
Hi

The tag you get in didReadData is the one you set when you write data.
That way you can differentiate between different ways of handling the
incomming data.

Per

> --
> You received this message because you are subscribed to the Google
> Groups "CocoaAsyncSocket" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cocoaasyncsocket/-/O7TN-Y-0cF0J.
> To post to this group, send email to cocoaasy...@googlegroups.com.
> To unsubscribe from this group, send email to
> cocoaasyncsock...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cocoaasyncsocket?hl=en.

Simeon Mitev

unread,
Apr 7, 2012, 1:23:53 PM4/7/12
to cocoaasy...@googlegroups.com
Calling readData you give a task to the socket to read. Your can send as
many tasks as you like before the others get complete actually. At the
end didReadData will be invoked when the data has been read. In order
for you to distinguish which data has been actually read you use the
TAG, formerly provided by your self.

Simeon

Flo

unread,
Apr 8, 2012, 10:18:18 AM4/8/12
to cocoaasy...@googlegroups.com
I could't expect such clear and quick answers, that's really clear now, thanks a lot guys !!!
Reply all
Reply to author
Forward
0 new messages