A ardillaprogramadora Member Licensed User Mar 11, 2018 #1 Hello, i have a socket array: Dim Sockets(20) As Socket I would like to handle all the connected socket events with only one function, something like this: Sub Sockets()_Connected(Connected As Boolean, i As Int)As Boolean End Sub EDIT: i tried this, but didnt work: Sub Sockets_Connected(Connected As Boolean)As Boolean Dim s As Socket s = Sender If s.Connected = True Then ToastMessageShow("Connected",True) End If End Sub any ideas? Last edited: Mar 11, 2018
Hello, i have a socket array: Dim Sockets(20) As Socket I would like to handle all the connected socket events with only one function, something like this: Sub Sockets()_Connected(Connected As Boolean, i As Int)As Boolean End Sub EDIT: i tried this, but didnt work: Sub Sockets_Connected(Connected As Boolean)As Boolean Dim s As Socket s = Sender If s.Connected = True Then ToastMessageShow("Connected",True) End If End Sub any ideas?
MarkusR Well-Known Member Licensed User Longtime User Mar 11, 2018 #2 where/how you initialized this sockets? (because event name) B4X: Sockets(0).Initialize("Socket") '... or B4X: .InitializeSSLAcceptAll("Socket") etc Last edited: Mar 11, 2018 Upvote 0
where/how you initialized this sockets? (because event name) B4X: Sockets(0).Initialize("Socket") '... or B4X: .InitializeSSLAcceptAll("Socket") etc
Erel B4X founder Staff member Licensed User Longtime User Mar 12, 2018 #3 Please use [code]code here...[/code] tags when posting code. Your code should work. Which error did you encounter? Though a better solution is to implement the connection in a class and create a class instance for each connection. Upvote 0
Please use [code]code here...[/code] tags when posting code. Your code should work. Which error did you encounter? Though a better solution is to implement the connection in a class and create a class instance for each connection.