I have the following code:
Dim socket As New HTTPSocket
Dim data As String = socket.Get(“http://14.1.37.57:2808/scapture?capture=last ”, 0) ’ using synchronous GET
'Dim data As String = socket.Get(“http://192.168.0.5:8090/shot.jpg ”, 0)
'http://14.1.37.57:2808/scapture?capture=last
'http://192.168.0.5:8090/shot.jpg
HTMLViewer1.LoadURL(“http://192.168.0.5:8090/shot.jpg ”)
If socket.HTTPStatusCode = 200 Then ’ OK
’ Picture.FromData creates a new picture from raw binary data
Dim p As Picture = Picture.FromData(data)
If p <> Nil Then
ImageWell1.Image = p
Else
MsgBox("Not a picture.")
End If
Else ’ errors, redirects, etc.
MsgBox("HTTP Status: " + Str(socket.HTTPStatusCode))
End If
The url string that is not commented works in the ImageWell, however the commented url works in the HTMLViewer and not in the ImageWell.
Both images are jpeg formats, they are different webcams, but in the browser are both jpeg images.
The commented one keeps throwing exceptions.
Any ideas, thanks.
I couldn’t tell you what’s up with that local address, but you want to check to see that it’s not redirecting or anything.
Check the HTTP status code before trying to use the data.
The HTTP Status code are both 200.
Couldn’t tell ya until we see what you’re getting back as data from the local webcam.
Norman_P
(Norman P)
November 11, 2016, 9:56pm
5
298038:@Darren Smith-Cameron:
Both images are jpeg formats, they are different webcams, but in the browser are both jpeg images.
Curious what kind of cameras you’re using ?
Not that it fixes the issue but more for my own curiosity
The one that works is an Automatic Number Plate Recognition (ANPR) camera inside a garage for testing purposes. The other is from an Android phone.
You should be able to reach both cameras, the external url for the second camera is http://150.101.188.111:8090/shot.jpg
DaveS
(DaveS)
November 11, 2016, 10:38pm
7
assuming it was a live picture… I see an open white door, a closed white door, and some “stuff” on a bench (with orange lids?)
and if you are in Australia… I’m in San Diego California… so thats a LONG ways
Exactly!!, the other is in New Zealand
DaveS
(DaveS)
November 11, 2016, 10:46pm
9
and I can see BOTH of them
Can you see both of them using the code from above?? or just in the browser.
DaveS
(DaveS)
November 11, 2016, 10:49pm
11
I just used a browser…
I’m not gonna try to cobble an app together… but if you want to post a working test app… I’ll try it for you
I have placed the code at the start , you can use an open event in a windows form or in a timer.action
DaveS
(DaveS)
November 11, 2016, 10:54pm
13
up to you… but I am not going to assume I know what you did… that code refers to htmlviewers etc… (hence the cobble reference). remember I’m doing you a favor here, not investing time to write code that may or may not be exactly what you have
Here is the code in an Open Event in a windows form, works as is, but not for the 150 url, hope that helps you to help me. Thanks.
Dim socket As New HTTPSocket
Dim data As String = socket.Get(“http://14.1.37.57:2808/scapture?capture=last ”, 0)
'Dim data As String = socket.Get(“http://150.101.188.111:8090/shot.jpg ”, 0)
If socket.HTTPStatusCode = 200 Then ’ OK
Dim p As Picture = Picture.FromData(data)
If p <> Nil Then
ImageWell1.Image = p
Else
MsgBox("Not a picture.")
End If
Else
MsgBox("HTTP Status: " + Str(socket.HTTPStatusCode))
End If
DaveS
(DaveS)
November 11, 2016, 11:06pm
15
well good luck with this problem… .since you don’t seem to want to provide a test app… I’m not inclined to pursue this for you
Thanks for your help, a simple effort would have gone a long way, I would not like to inconvenience anyone. But it has been resolved as it is depends on the how the individual servers are serving the html.
DaveS
(DaveS)
November 11, 2016, 11:24pm
17
yes a simple effort would have, but you seemed disinclined to make… sorry,
Norman_P
(Norman P)
November 11, 2016, 11:56pm
18