How to implement Await Task, for faster Web Scrap. How to make my code faster?











up vote
-1
down vote

favorite












This is a unix timestamp based data, which needs to be scrapped.
Files in server can be 1542688763.png or 1542688763.jpg
so my system decrement a given unix timestamp, one by one and check if the file exists.
A web developer made the same thing and his is vry fast. He said me, that due to improper usage of IO bound and CPU bound process, and improper requst and await code, my program is slower. Can anyone help?



Imports System.Net.Http
Imports System.Net
Imports System.IO
Imports System.Threading



Public Class Form1
Dim VarHoldingUnix As Double
Dim KotafOund As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
VarHoldingUnix = ToUnix(Date.Now)
TextBox1.Text = VarHoldingUnix
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim DRON As Date
DRON = FromUnix(VarHoldingUnix, 0)
MsgBox(DRON)
MsgBox(DateAndTime.Day(DRON))
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim ABCD As Task


While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Application.DoEvents()
ABCD = MakeRequests(300)
End While

MsgBox("END")
End

End Sub

Async Function MakeRequests(noS2find As Integer) As Task

Dim tasks As List(Of Task(Of Boolean)) = New List(Of Task(Of Boolean))
Dim tasks2 As List(Of Task(Of Boolean)) = New List(Of Task(Of Boolean))
Dim itemsF As Integer = noS2find

Dim DRON As Date
Dim DronDate As String

Dim MyYear, MyMonth As String

DRON = FromUnix(VarHoldingUnix, 0)



For i = 1 To itemsF
i = i + 1
DRON = FromUnix(VarHoldingUnix, 0)
'DronDate = (DateAndTime.Day(DRON))


Dim MYURLJPG As String = "https://www.secru.com/img/" & VarHoldingUnix & ".png"
tasks.Add(CheckPageExists1(MYURLJPG))
'await Task.Run(() => CheckPageExists1(MYURLJPG));
Dim MYURLPNG As String = "https://www.secru.com/img/" & VarHoldingUnix & ".jpg"
tasks2.Add(CheckPageExists2(MYURLPNG))
'await Task.Run(() => CheckPageExists2(MYURLPNG))

VarHoldingUnix = VarHoldingUnix - 1
Next

While tasks.Select(Function(x) x.Result).Count < tasks.Count
Thread.Sleep(100)
End While

While tasks2.Select(Function(x) x.Result).Count < tasks2.Count
Thread.Sleep(100)
End While



End Function

Private Async Function CheckPageExists1(ByVal url As String) As Task(Of Boolean)


Dim request As Net.HttpWebRequest = Net.WebRequest.Create(url)
request.Method = "HEAD"
'Dim response As Net.HttpWebResponse
request.Timeout = 5

Dim Result As Boolean

Try
Using response As HttpWebResponse = Await request.GetResponseAsync.ConfigureAwait(False)
Using responseReader As New IO.StreamReader(response.GetResponseStream)

Dim actualResponse As String = Await responseReader.ReadToEndAsync
Result = True
KotafOund = KotafOund + 1
Process.Start(url)
End Using
End Using
Catch ex As Exception
'IMAGE DOES NOT EXITS
Result = False
End Try

Return Result

End Function
Private Async Function CheckPageExists2(ByVal url As String) As Task(Of Boolean)



Dim request As Net.HttpWebRequest = Net.WebRequest.Create(url)
'Dim response As Net.HttpWebResponse
request.Method = "HEAD"
request.Timeout = 5

Dim Result As Boolean

Try
Using response As HttpWebResponse = Await request.GetResponseAsync.ConfigureAwait(False)
Using responseReader As New IO.StreamReader(response.GetResponseStream)

Dim actualResponse As String = Await responseReader.ReadToEndAsync
Result = True
KotafOund = KotafOund + 1
Process.Start(url)
End Using
End Using
Catch ex As Exception
'IMAGE DOES NOT EXITS
Result = False
End Try

Return Result

End Function

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
VarHoldingUnix = TextBox1.Text

MsgBox("Confirmed New UNIX-VARIABLE " & VarHoldingUnix)
End Sub
End Class


I think inside Async Function MakeRequests I have to use this code



While tasks.Select(Function(x) x.Result).Count < tasks.Count
Await Task.Delay(100)
End While


instead of



While tasks.Select(Function(x) x.Result).Count < tasks.Count
Thread.Sleep(100)
End While


but i am not getting a perfect balance of the no of milliseconds i set within wait (100) now, and



ABCD = MakeRequests(300)


can be 200 or may be 2000.



I dont know....you guys are better knowledgeable










share|improve this question
























  • What's that ToUnix and FromUnix?
    – Paulo Morgado
    Nov 20 at 15:28










  • send a date.now to ToUnix() to convert it into UNIX time stamp....and viceversa
    – Ranajoy Roy
    Nov 21 at 5:31










  • date to unix timestamp conversion function....and viceversa....this is a global function declared by me
    – Ranajoy Roy
    Nov 21 at 7:43










  • Any particular reason for not using DateTimeOffset's functions?
    – Paulo Morgado
    Nov 21 at 7:48










  • yes....because the files are stored by the unixtimestamp name. Ex 21nov2018 in unix may be 123456765, files kept in the server i am scrapping are www.secru.com/images/123456765.jpg The software takes a given date, uses this function to convert it into unix time stamp, and then in loop sends request to server to check if the file is there....and then increases the unixtimestaamp value everytime by 1..and then chk again for the file.
    – Ranajoy Roy
    Nov 21 at 11:27

















up vote
-1
down vote

favorite












This is a unix timestamp based data, which needs to be scrapped.
Files in server can be 1542688763.png or 1542688763.jpg
so my system decrement a given unix timestamp, one by one and check if the file exists.
A web developer made the same thing and his is vry fast. He said me, that due to improper usage of IO bound and CPU bound process, and improper requst and await code, my program is slower. Can anyone help?



Imports System.Net.Http
Imports System.Net
Imports System.IO
Imports System.Threading



Public Class Form1
Dim VarHoldingUnix As Double
Dim KotafOund As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
VarHoldingUnix = ToUnix(Date.Now)
TextBox1.Text = VarHoldingUnix
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim DRON As Date
DRON = FromUnix(VarHoldingUnix, 0)
MsgBox(DRON)
MsgBox(DateAndTime.Day(DRON))
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim ABCD As Task


While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Application.DoEvents()
ABCD = MakeRequests(300)
End While

MsgBox("END")
End

End Sub

Async Function MakeRequests(noS2find As Integer) As Task

Dim tasks As List(Of Task(Of Boolean)) = New List(Of Task(Of Boolean))
Dim tasks2 As List(Of Task(Of Boolean)) = New List(Of Task(Of Boolean))
Dim itemsF As Integer = noS2find

Dim DRON As Date
Dim DronDate As String

Dim MyYear, MyMonth As String

DRON = FromUnix(VarHoldingUnix, 0)



For i = 1 To itemsF
i = i + 1
DRON = FromUnix(VarHoldingUnix, 0)
'DronDate = (DateAndTime.Day(DRON))


Dim MYURLJPG As String = "https://www.secru.com/img/" & VarHoldingUnix & ".png"
tasks.Add(CheckPageExists1(MYURLJPG))
'await Task.Run(() => CheckPageExists1(MYURLJPG));
Dim MYURLPNG As String = "https://www.secru.com/img/" & VarHoldingUnix & ".jpg"
tasks2.Add(CheckPageExists2(MYURLPNG))
'await Task.Run(() => CheckPageExists2(MYURLPNG))

VarHoldingUnix = VarHoldingUnix - 1
Next

While tasks.Select(Function(x) x.Result).Count < tasks.Count
Thread.Sleep(100)
End While

While tasks2.Select(Function(x) x.Result).Count < tasks2.Count
Thread.Sleep(100)
End While



End Function

Private Async Function CheckPageExists1(ByVal url As String) As Task(Of Boolean)


Dim request As Net.HttpWebRequest = Net.WebRequest.Create(url)
request.Method = "HEAD"
'Dim response As Net.HttpWebResponse
request.Timeout = 5

Dim Result As Boolean

Try
Using response As HttpWebResponse = Await request.GetResponseAsync.ConfigureAwait(False)
Using responseReader As New IO.StreamReader(response.GetResponseStream)

Dim actualResponse As String = Await responseReader.ReadToEndAsync
Result = True
KotafOund = KotafOund + 1
Process.Start(url)
End Using
End Using
Catch ex As Exception
'IMAGE DOES NOT EXITS
Result = False
End Try

Return Result

End Function
Private Async Function CheckPageExists2(ByVal url As String) As Task(Of Boolean)



Dim request As Net.HttpWebRequest = Net.WebRequest.Create(url)
'Dim response As Net.HttpWebResponse
request.Method = "HEAD"
request.Timeout = 5

Dim Result As Boolean

Try
Using response As HttpWebResponse = Await request.GetResponseAsync.ConfigureAwait(False)
Using responseReader As New IO.StreamReader(response.GetResponseStream)

Dim actualResponse As String = Await responseReader.ReadToEndAsync
Result = True
KotafOund = KotafOund + 1
Process.Start(url)
End Using
End Using
Catch ex As Exception
'IMAGE DOES NOT EXITS
Result = False
End Try

Return Result

End Function

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
VarHoldingUnix = TextBox1.Text

MsgBox("Confirmed New UNIX-VARIABLE " & VarHoldingUnix)
End Sub
End Class


I think inside Async Function MakeRequests I have to use this code



While tasks.Select(Function(x) x.Result).Count < tasks.Count
Await Task.Delay(100)
End While


instead of



While tasks.Select(Function(x) x.Result).Count < tasks.Count
Thread.Sleep(100)
End While


but i am not getting a perfect balance of the no of milliseconds i set within wait (100) now, and



ABCD = MakeRequests(300)


can be 200 or may be 2000.



I dont know....you guys are better knowledgeable










share|improve this question
























  • What's that ToUnix and FromUnix?
    – Paulo Morgado
    Nov 20 at 15:28










  • send a date.now to ToUnix() to convert it into UNIX time stamp....and viceversa
    – Ranajoy Roy
    Nov 21 at 5:31










  • date to unix timestamp conversion function....and viceversa....this is a global function declared by me
    – Ranajoy Roy
    Nov 21 at 7:43










  • Any particular reason for not using DateTimeOffset's functions?
    – Paulo Morgado
    Nov 21 at 7:48










  • yes....because the files are stored by the unixtimestamp name. Ex 21nov2018 in unix may be 123456765, files kept in the server i am scrapping are www.secru.com/images/123456765.jpg The software takes a given date, uses this function to convert it into unix time stamp, and then in loop sends request to server to check if the file is there....and then increases the unixtimestaamp value everytime by 1..and then chk again for the file.
    – Ranajoy Roy
    Nov 21 at 11:27















up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











This is a unix timestamp based data, which needs to be scrapped.
Files in server can be 1542688763.png or 1542688763.jpg
so my system decrement a given unix timestamp, one by one and check if the file exists.
A web developer made the same thing and his is vry fast. He said me, that due to improper usage of IO bound and CPU bound process, and improper requst and await code, my program is slower. Can anyone help?



Imports System.Net.Http
Imports System.Net
Imports System.IO
Imports System.Threading



Public Class Form1
Dim VarHoldingUnix As Double
Dim KotafOund As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
VarHoldingUnix = ToUnix(Date.Now)
TextBox1.Text = VarHoldingUnix
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim DRON As Date
DRON = FromUnix(VarHoldingUnix, 0)
MsgBox(DRON)
MsgBox(DateAndTime.Day(DRON))
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim ABCD As Task


While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Application.DoEvents()
ABCD = MakeRequests(300)
End While

MsgBox("END")
End

End Sub

Async Function MakeRequests(noS2find As Integer) As Task

Dim tasks As List(Of Task(Of Boolean)) = New List(Of Task(Of Boolean))
Dim tasks2 As List(Of Task(Of Boolean)) = New List(Of Task(Of Boolean))
Dim itemsF As Integer = noS2find

Dim DRON As Date
Dim DronDate As String

Dim MyYear, MyMonth As String

DRON = FromUnix(VarHoldingUnix, 0)



For i = 1 To itemsF
i = i + 1
DRON = FromUnix(VarHoldingUnix, 0)
'DronDate = (DateAndTime.Day(DRON))


Dim MYURLJPG As String = "https://www.secru.com/img/" & VarHoldingUnix & ".png"
tasks.Add(CheckPageExists1(MYURLJPG))
'await Task.Run(() => CheckPageExists1(MYURLJPG));
Dim MYURLPNG As String = "https://www.secru.com/img/" & VarHoldingUnix & ".jpg"
tasks2.Add(CheckPageExists2(MYURLPNG))
'await Task.Run(() => CheckPageExists2(MYURLPNG))

VarHoldingUnix = VarHoldingUnix - 1
Next

While tasks.Select(Function(x) x.Result).Count < tasks.Count
Thread.Sleep(100)
End While

While tasks2.Select(Function(x) x.Result).Count < tasks2.Count
Thread.Sleep(100)
End While



End Function

Private Async Function CheckPageExists1(ByVal url As String) As Task(Of Boolean)


Dim request As Net.HttpWebRequest = Net.WebRequest.Create(url)
request.Method = "HEAD"
'Dim response As Net.HttpWebResponse
request.Timeout = 5

Dim Result As Boolean

Try
Using response As HttpWebResponse = Await request.GetResponseAsync.ConfigureAwait(False)
Using responseReader As New IO.StreamReader(response.GetResponseStream)

Dim actualResponse As String = Await responseReader.ReadToEndAsync
Result = True
KotafOund = KotafOund + 1
Process.Start(url)
End Using
End Using
Catch ex As Exception
'IMAGE DOES NOT EXITS
Result = False
End Try

Return Result

End Function
Private Async Function CheckPageExists2(ByVal url As String) As Task(Of Boolean)



Dim request As Net.HttpWebRequest = Net.WebRequest.Create(url)
'Dim response As Net.HttpWebResponse
request.Method = "HEAD"
request.Timeout = 5

Dim Result As Boolean

Try
Using response As HttpWebResponse = Await request.GetResponseAsync.ConfigureAwait(False)
Using responseReader As New IO.StreamReader(response.GetResponseStream)

Dim actualResponse As String = Await responseReader.ReadToEndAsync
Result = True
KotafOund = KotafOund + 1
Process.Start(url)
End Using
End Using
Catch ex As Exception
'IMAGE DOES NOT EXITS
Result = False
End Try

Return Result

End Function

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
VarHoldingUnix = TextBox1.Text

MsgBox("Confirmed New UNIX-VARIABLE " & VarHoldingUnix)
End Sub
End Class


I think inside Async Function MakeRequests I have to use this code



While tasks.Select(Function(x) x.Result).Count < tasks.Count
Await Task.Delay(100)
End While


instead of



While tasks.Select(Function(x) x.Result).Count < tasks.Count
Thread.Sleep(100)
End While


but i am not getting a perfect balance of the no of milliseconds i set within wait (100) now, and



ABCD = MakeRequests(300)


can be 200 or may be 2000.



I dont know....you guys are better knowledgeable










share|improve this question















This is a unix timestamp based data, which needs to be scrapped.
Files in server can be 1542688763.png or 1542688763.jpg
so my system decrement a given unix timestamp, one by one and check if the file exists.
A web developer made the same thing and his is vry fast. He said me, that due to improper usage of IO bound and CPU bound process, and improper requst and await code, my program is slower. Can anyone help?



Imports System.Net.Http
Imports System.Net
Imports System.IO
Imports System.Threading



Public Class Form1
Dim VarHoldingUnix As Double
Dim KotafOund As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
VarHoldingUnix = ToUnix(Date.Now)
TextBox1.Text = VarHoldingUnix
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim DRON As Date
DRON = FromUnix(VarHoldingUnix, 0)
MsgBox(DRON)
MsgBox(DateAndTime.Day(DRON))
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim ABCD As Task


While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Application.DoEvents()
ABCD = MakeRequests(300)
End While

MsgBox("END")
End

End Sub

Async Function MakeRequests(noS2find As Integer) As Task

Dim tasks As List(Of Task(Of Boolean)) = New List(Of Task(Of Boolean))
Dim tasks2 As List(Of Task(Of Boolean)) = New List(Of Task(Of Boolean))
Dim itemsF As Integer = noS2find

Dim DRON As Date
Dim DronDate As String

Dim MyYear, MyMonth As String

DRON = FromUnix(VarHoldingUnix, 0)



For i = 1 To itemsF
i = i + 1
DRON = FromUnix(VarHoldingUnix, 0)
'DronDate = (DateAndTime.Day(DRON))


Dim MYURLJPG As String = "https://www.secru.com/img/" & VarHoldingUnix & ".png"
tasks.Add(CheckPageExists1(MYURLJPG))
'await Task.Run(() => CheckPageExists1(MYURLJPG));
Dim MYURLPNG As String = "https://www.secru.com/img/" & VarHoldingUnix & ".jpg"
tasks2.Add(CheckPageExists2(MYURLPNG))
'await Task.Run(() => CheckPageExists2(MYURLPNG))

VarHoldingUnix = VarHoldingUnix - 1
Next

While tasks.Select(Function(x) x.Result).Count < tasks.Count
Thread.Sleep(100)
End While

While tasks2.Select(Function(x) x.Result).Count < tasks2.Count
Thread.Sleep(100)
End While



End Function

Private Async Function CheckPageExists1(ByVal url As String) As Task(Of Boolean)


Dim request As Net.HttpWebRequest = Net.WebRequest.Create(url)
request.Method = "HEAD"
'Dim response As Net.HttpWebResponse
request.Timeout = 5

Dim Result As Boolean

Try
Using response As HttpWebResponse = Await request.GetResponseAsync.ConfigureAwait(False)
Using responseReader As New IO.StreamReader(response.GetResponseStream)

Dim actualResponse As String = Await responseReader.ReadToEndAsync
Result = True
KotafOund = KotafOund + 1
Process.Start(url)
End Using
End Using
Catch ex As Exception
'IMAGE DOES NOT EXITS
Result = False
End Try

Return Result

End Function
Private Async Function CheckPageExists2(ByVal url As String) As Task(Of Boolean)



Dim request As Net.HttpWebRequest = Net.WebRequest.Create(url)
'Dim response As Net.HttpWebResponse
request.Method = "HEAD"
request.Timeout = 5

Dim Result As Boolean

Try
Using response As HttpWebResponse = Await request.GetResponseAsync.ConfigureAwait(False)
Using responseReader As New IO.StreamReader(response.GetResponseStream)

Dim actualResponse As String = Await responseReader.ReadToEndAsync
Result = True
KotafOund = KotafOund + 1
Process.Start(url)
End Using
End Using
Catch ex As Exception
'IMAGE DOES NOT EXITS
Result = False
End Try

Return Result

End Function

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
VarHoldingUnix = TextBox1.Text

MsgBox("Confirmed New UNIX-VARIABLE " & VarHoldingUnix)
End Sub
End Class


I think inside Async Function MakeRequests I have to use this code



While tasks.Select(Function(x) x.Result).Count < tasks.Count
Await Task.Delay(100)
End While


instead of



While tasks.Select(Function(x) x.Result).Count < tasks.Count
Thread.Sleep(100)
End While


but i am not getting a perfect balance of the no of milliseconds i set within wait (100) now, and



ABCD = MakeRequests(300)


can be 200 or may be 2000.



I dont know....you guys are better knowledgeable







.net vb.net asynchronous async-await






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 11:43

























asked Nov 20 at 6:05









Ranajoy Roy

1418




1418












  • What's that ToUnix and FromUnix?
    – Paulo Morgado
    Nov 20 at 15:28










  • send a date.now to ToUnix() to convert it into UNIX time stamp....and viceversa
    – Ranajoy Roy
    Nov 21 at 5:31










  • date to unix timestamp conversion function....and viceversa....this is a global function declared by me
    – Ranajoy Roy
    Nov 21 at 7:43










  • Any particular reason for not using DateTimeOffset's functions?
    – Paulo Morgado
    Nov 21 at 7:48










  • yes....because the files are stored by the unixtimestamp name. Ex 21nov2018 in unix may be 123456765, files kept in the server i am scrapping are www.secru.com/images/123456765.jpg The software takes a given date, uses this function to convert it into unix time stamp, and then in loop sends request to server to check if the file is there....and then increases the unixtimestaamp value everytime by 1..and then chk again for the file.
    – Ranajoy Roy
    Nov 21 at 11:27




















  • What's that ToUnix and FromUnix?
    – Paulo Morgado
    Nov 20 at 15:28










  • send a date.now to ToUnix() to convert it into UNIX time stamp....and viceversa
    – Ranajoy Roy
    Nov 21 at 5:31










  • date to unix timestamp conversion function....and viceversa....this is a global function declared by me
    – Ranajoy Roy
    Nov 21 at 7:43










  • Any particular reason for not using DateTimeOffset's functions?
    – Paulo Morgado
    Nov 21 at 7:48










  • yes....because the files are stored by the unixtimestamp name. Ex 21nov2018 in unix may be 123456765, files kept in the server i am scrapping are www.secru.com/images/123456765.jpg The software takes a given date, uses this function to convert it into unix time stamp, and then in loop sends request to server to check if the file is there....and then increases the unixtimestaamp value everytime by 1..and then chk again for the file.
    – Ranajoy Roy
    Nov 21 at 11:27


















What's that ToUnix and FromUnix?
– Paulo Morgado
Nov 20 at 15:28




What's that ToUnix and FromUnix?
– Paulo Morgado
Nov 20 at 15:28












send a date.now to ToUnix() to convert it into UNIX time stamp....and viceversa
– Ranajoy Roy
Nov 21 at 5:31




send a date.now to ToUnix() to convert it into UNIX time stamp....and viceversa
– Ranajoy Roy
Nov 21 at 5:31












date to unix timestamp conversion function....and viceversa....this is a global function declared by me
– Ranajoy Roy
Nov 21 at 7:43




date to unix timestamp conversion function....and viceversa....this is a global function declared by me
– Ranajoy Roy
Nov 21 at 7:43












Any particular reason for not using DateTimeOffset's functions?
– Paulo Morgado
Nov 21 at 7:48




Any particular reason for not using DateTimeOffset's functions?
– Paulo Morgado
Nov 21 at 7:48












yes....because the files are stored by the unixtimestamp name. Ex 21nov2018 in unix may be 123456765, files kept in the server i am scrapping are www.secru.com/images/123456765.jpg The software takes a given date, uses this function to convert it into unix time stamp, and then in loop sends request to server to check if the file is there....and then increases the unixtimestaamp value everytime by 1..and then chk again for the file.
– Ranajoy Roy
Nov 21 at 11:27






yes....because the files are stored by the unixtimestamp name. Ex 21nov2018 in unix may be 123456765, files kept in the server i am scrapping are www.secru.com/images/123456765.jpg The software takes a given date, uses this function to convert it into unix time stamp, and then in loop sends request to server to check if the file is there....and then increases the unixtimestaamp value everytime by 1..and then chk again for the file.
– Ranajoy Roy
Nov 21 at 11:27














1 Answer
1






active

oldest

votes

















up vote
-1
down vote













Have you tried this?



Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Await MakeRequests(300)
End While

MsgBox("END")
End

End Sub





share|improve this answer





















  • it does not work
    – Ranajoy Roy
    Nov 21 at 4:17










  • And, do you want it to work?
    – Paulo Morgado
    Nov 21 at 7:46










  • my code already works...need to make it faster
    – Ranajoy Roy
    Nov 21 at 11:31











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387140%2fhow-to-implement-await-task-for-faster-web-scrap-how-to-make-my-code-faster%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
-1
down vote













Have you tried this?



Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Await MakeRequests(300)
End While

MsgBox("END")
End

End Sub





share|improve this answer





















  • it does not work
    – Ranajoy Roy
    Nov 21 at 4:17










  • And, do you want it to work?
    – Paulo Morgado
    Nov 21 at 7:46










  • my code already works...need to make it faster
    – Ranajoy Roy
    Nov 21 at 11:31















up vote
-1
down vote













Have you tried this?



Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Await MakeRequests(300)
End While

MsgBox("END")
End

End Sub





share|improve this answer





















  • it does not work
    – Ranajoy Roy
    Nov 21 at 4:17










  • And, do you want it to work?
    – Paulo Morgado
    Nov 21 at 7:46










  • my code already works...need to make it faster
    – Ranajoy Roy
    Nov 21 at 11:31













up vote
-1
down vote










up vote
-1
down vote









Have you tried this?



Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Await MakeRequests(300)
End While

MsgBox("END")
End

End Sub





share|improve this answer












Have you tried this?



Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

While Not KotafOund = TextBox3.Text
ToolStripLabel1.Text = FromUnix(VarHoldingUnix, 0)
Await MakeRequests(300)
End While

MsgBox("END")
End

End Sub






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 at 15:43









Paulo Morgado

5,51611531




5,51611531












  • it does not work
    – Ranajoy Roy
    Nov 21 at 4:17










  • And, do you want it to work?
    – Paulo Morgado
    Nov 21 at 7:46










  • my code already works...need to make it faster
    – Ranajoy Roy
    Nov 21 at 11:31


















  • it does not work
    – Ranajoy Roy
    Nov 21 at 4:17










  • And, do you want it to work?
    – Paulo Morgado
    Nov 21 at 7:46










  • my code already works...need to make it faster
    – Ranajoy Roy
    Nov 21 at 11:31
















it does not work
– Ranajoy Roy
Nov 21 at 4:17




it does not work
– Ranajoy Roy
Nov 21 at 4:17












And, do you want it to work?
– Paulo Morgado
Nov 21 at 7:46




And, do you want it to work?
– Paulo Morgado
Nov 21 at 7:46












my code already works...need to make it faster
– Ranajoy Roy
Nov 21 at 11:31




my code already works...need to make it faster
– Ranajoy Roy
Nov 21 at 11:31


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387140%2fhow-to-implement-await-task-for-faster-web-scrap-how-to-make-my-code-faster%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin