Antoine
Regular
Dear all,
I have written a piece of code to get information out of a number of IP camera's and import it using a webclient. But when the camera fails for some reason, the whole software stops responding, because it is waiting for the data that never comes.
Is there a possible way to let the webclient generate a time-out when there is no data for a certain amount of time ?
Thanks in advance
Antoine
[edit]
Btw, I don't mind that it is taking 80 seconds to find out that it doesn't exist, but more the fact the the whole application stands still (I thought windows was multitasking ?), is there a way to make it run in the background or something ?
[/edit]
I have written a piece of code to get information out of a number of IP camera's and import it using a webclient. But when the camera fails for some reason, the whole software stops responding, because it is waiting for the data that never comes.
Is there a possible way to let the webclient generate a time-out when there is no data for a certain amount of time ?
Visual Basic:
Dim myWebClient As New System.Net.WebClient
Try
tmrVideoRefresh.Enabled = False
Dim remoteUrl As String = CameraArray(CurrentCam, 2)
Dim myDatabuffer As Byte() = myWebClient.DownloadData(remoteUrl)
Dim MyMemoryStream As New System.IO.MemoryStream(myDatabuffer)
Dim img As Image = Image.FromStream(MyMemoryStream)
VideoBox(Val(CameraArray(CurrentCam, 1))).Image = img
tmrVideoRefresh.Enabled = True
Catch ex As System.Net.WebException
MessageBox.Show(ex.Message)
Exit Try
Catch ex As Security.SecurityException
MessageBox.Show(ex.Message)
Exit Try
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Try
End Try
Thanks in advance
Antoine
[edit]
Btw, I don't mind that it is taking 80 seconds to find out that it doesn't exist, but more the fact the the whole application stands still (I thought windows was multitasking ?), is there a way to make it run in the background or something ?
[/edit]
Last edited: