File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes InputStream from password protected http site Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "InputStream from password protected http site" Watch "InputStream from password protected http site" New topic

InputStream from password protected http site

Jay Crawf

Joined: Sep 15, 2013
Posts: 10

So I'm trying to develop a program that will send a snapshot command to an IP camera, and then save the resulting jpeg to a local file. If I navigate to the URL specified in the webPage string with a browser, I am prompted for the username/password and then presented with a page with the snapshot. When I attempt to do the same thing with my program, I get a connection refused error on opening the inputstream. I'm certain there isn't a firewall/port issue since I can get to the page with a browser on the same machine, and it is a http rather than a https address.

Am I on the wrong track with how I am trying to go about doing this?


Paul Clapham

Joined: Oct 14, 2005
Posts: 19691

Some possibilities: I notice your server is listening on port 81; did you include that port number when you asked the browser to connect to it? And when the browser connected, did it ask you to authenticate yourself via a dialog box asking for user ID and password?

And even though your server appears to be on the same LAN as your client software, does your browser connect to the server via an HTTP proxy server?
Jay Crawf

Joined: Sep 15, 2013
Posts: 10
I also specify the port when connecting thru browser (just copied and pasted the String value from the browser).

There is no HTTP proxy involved on the LAN.

The page prompts authentication via a pop-up menu. Is my method of authenticating not going to work in this case?
I agree. Here's the link:
subject: InputStream from password protected http site
It's not a secret anymore!