I am using AsyncSocket for a TCP connection.
I have one TCP socket, but I have two UIViewControllers use this socket.
As I know, there is only one delegate while I init the AsyncSocket.
These two UIViewControllers both need to handle the callback from the AsyncSocket.
Is there any good idea to achieve this?
Any idea is appreciated!
You can use nsnotificationcenter, to notify two view controllers about callback from AsyncSocket. You can use AsyncSocket code in some appcontroller (you may create it for your app)/appdelegate. when it fires it callback you can sent Notification AsyncSocketNoftication (you have to create named notification like this) which is captured by respective viewcontroller which are listening to AsyncSocketNoftication. this is useful even you want to notify many number of viewcontrollers.
Hope it helps !