Starting from v1.70 of Net, jNet and iNet libraries the asynchronous methods return a 'sender filter' object.
This object can be passed as the sender filter parameter in a Wait For call.
This makes it simpler to manage multiple requests.
For example:
Multiple subs can wait for the same event. Thanks to the sender filter parameter, each event will be intercepted in the correct wait for call.
The same technique can be used with all asynchronous methods in the Net library.
Notes
- iNet v1.70 will be included in B4i v4.40.
This object can be passed as the sender filter parameter in a Wait For call.
This makes it simpler to manage multiple requests.
For example:
B4X:
'ftp was previously initialized and its event name was set to ftp:
'ftp.Initialize("ftp", "your.server", 21, "user", "password")
Dim sf As Object = ftp.UploadFile(File.DirAssets, "somefile", False, "/somefile")
Wait For (sf) ftp_UploadCompleted (ServerPath As String, Success As Boolean)
If Success Then
Log("file was uploaded successfully")
Else
Log("Error uploading file")
End If
The same technique can be used with all asynchronous methods in the Net library.
Notes
- iNet v1.70 will be included in B4i v4.40.