Synchronizing procedures
Posted: Thu Jun 20, 2024 7:55 am
Hi @ all
I am wondering how I can synchronize procedures especially automated httprequests.
Following a schematic code:
OK, The ReadFileCallback() is much faster than the called HTTPGetEventCSV() so the ReadFileCallback() always fires requests. The delay for the reply of the HTTPGetEventCSV() is 0.5 to 1 second.
My questions are
1. Does this construct cause a possible DoS attack created by myself at a high quantity of requests (e.g. 100 users work at the same time with csv files having 100000 lines in CSV file ? (personally I would say yes)
2. How can I synchronize this construct so a new request of ReadFileCallback() will be releases earliest the HTTPGetEventCSV() has sent the result
Further samples are welcome.
Edit: 24.06.2024 (Comment extension)
It seems to be a hard problem !?
Is the problem explanation not clear?
I am wondering how I can synchronize procedures especially automated httprequests.
Following a schematic code:
Code: Select all
Procedure HttpGetEventCSV(success,result$,userdata)
If success
<do whatever you want with result$>
EndIf
EndProcedure
Procedure ReadFileCallback()
protected nblines.i, i.i
<read file content process here >
For i = 1 To nblines
HTTPRequest(#PB_HTTP_GET,<url incl actual line information>,"",@HttpGetEventCSV(),i)
next
EndProcedure
Procedure CSVFileRequesterCallback()
If NextSelectedFile()
OpenFile(#file,SelectedFileID(),@ReadFileCallback(),#pb_LocalFile)
EndIf
EndProcedure
Procedure openFileEvent()
openFileRequester("text/csv",@CSVFileRequesterCallback())
EndProcedure
Procedure main()
openFileEvent()
EndProcedure
main()
My questions are
1. Does this construct cause a possible DoS attack created by myself at a high quantity of requests (e.g. 100 users work at the same time with csv files having 100000 lines in CSV file ? (personally I would say yes)
2. How can I synchronize this construct so a new request of ReadFileCallback() will be releases earliest the HTTPGetEventCSV() has sent the result
Further samples are welcome.
Edit: 24.06.2024 (Comment extension)
It seems to be a hard problem !?

Is the problem explanation not clear?