D DemoFreak Member Licensed User Longtime User Dec 22, 2011 #1 Hi, is there a possibility to store an object reference into a network socket resp. an ASyncStreams object (like the Button.Tag property in the Tick Tack Toe example)? I want to connect to several devices via TCP sockets, read out some data with AsyncStreams and store the data to a data structure. As I don't want to iterate over an array of data structures every time the AsyncStreams new data event fires, I'm wondering if there's a possibility to tie the data structure to socket like that Code: Copy Sub Activity_Create() Dim Sock as Socket Sock.Initialize("Sock") Sock.Connect(...) End Sub Sub Sock_Connected() Dim s as Socket s = Sender Dim Data As MyType s.Tag = Data End Sub That wouldn't even work when ASyncStreams comes into play, but maybe the snippet explains my question. Or, do I think the wrong way and there's another approach to solve that problem? Regards, Hannes
Hi, is there a possibility to store an object reference into a network socket resp. an ASyncStreams object (like the Button.Tag property in the Tick Tack Toe example)? I want to connect to several devices via TCP sockets, read out some data with AsyncStreams and store the data to a data structure. As I don't want to iterate over an array of data structures every time the AsyncStreams new data event fires, I'm wondering if there's a possibility to tie the data structure to socket like that Code: Copy Sub Activity_Create() Dim Sock as Socket Sock.Initialize("Sock") Sock.Connect(...) End Sub Sub Sock_Connected() Dim s as Socket s = Sender Dim Data As MyType s.Tag = Data End Sub That wouldn't even work when ASyncStreams comes into play, but maybe the snippet explains my question. Or, do I think the wrong way and there's another approach to solve that problem? Regards, Hannes
Erel B4X founder Staff member Licensed User Longtime User Dec 23, 2011 #2 You can use a Map to tie between the objects. The sockets should be the keys and MyTypes the values. Upvote 0
D DemoFreak Member Licensed User Longtime User Dec 25, 2011 #3 Obvious. I should've hit on that idea myself. Thanks. Upvote 0