Tag-like property for network socket

DemoFreak

Member
Licensed User
Longtime User
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

B4X:
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
 
Top