tags:

views:

351

answers:

2

I am basically sending a URL to control the tilt and pan of an IP camera, so all I need to do is send the request, I am not worried about receiving anything. Currently I am using:

Dim Request As HttpWebRequest = WebRequest.Create("http://xxx.xxx.xxx.xxx/nphControlCamera?Direction=TiltDown&Resolution=320x240&Quality=Standard&RPeriod=0&Size=STD&PresetOperation=Move&Language=3")
Dim Response As HttpWebResponse = Request.GetResponse

My problem here is, if I hit it two or three times it locks up my program. So what am I either doing wrong, or what is the best way to send this URL?

Thanks

+2  A: 

Are you returning any response at all from the camera? It seems like your program is waiting for a response and getting nothing.

Jeff.Crossett
I didn't even think to ask that, guess it could be important ;)
AlexCuse
I really don't need to get a response at all. I am viewing the camera live through the Windows Media encoder SDK, so if I hit the link you will be able to visually look and see the camera move. I just need to send the URL
Bruno43
Understood, but the code you are writing is going to wait for the response, so if none is received, the code will timeout.
Jeff.Crossett
So then what code should I use to just send out the URL and not wait for a response?
Bruno43
I have a feeling that the device is only responding with a status code, and nothing else. I seem to recall that setting the HttpWebRequest KeepAlive property to false, or changing the ProtocolVersion to 1.0 can help.
Jeff.Crossett
+3  A: 

You might have better luck calling it asynchronously, and preventing the user from sending the request again until the camera gets itself situated?

Basically you'd use BeginGetResponse instead of GetResponse.

This might be of use: http://stackoverflow.com/questions/128282/how-do-you-call-an-asynchronous-web-request-in-vbnet

AlexCuse