Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Proxy-problem

Reply
Thread Tools

Proxy-problem

 
 
Sven Junge
Guest
Posts: n/a
 
      06-14-2004
Hello,

I'm behind a Firewall and trying to connect with the following code to an
inet-address:

URL url = new URL(urlStr);
InputStream uin = url.openStream();
BufferedReader in = new BufferedReader( new InputStreamReader(uin));
boolean more = true;
while (more)
{
String line = in.readLine();
if (line==null)
more = false;
else
System.out.println( line );
}

My problem is that I can read out every HTML-code I get from websites within
the LAN, but by trying to connect to public sites in the net I only get this
exception:
"java.net.SocketException: Unexpected end of file from server"

Thanks for your help!

Sven Junge


 
Reply With Quote
 
 
 
 
Yu SONG
Guest
Posts: n/a
 
      06-16-2004
Sven Junge wrote:
> Hello,
>
> I'm behind a Firewall and trying to connect with the following code to an
> inet-address:
>
> URL url = new URL(urlStr);
> InputStream uin = url.openStream();
> BufferedReader in = new BufferedReader( new InputStreamReader(uin));
> boolean more = true;
> while (more)
> {
> String line = in.readLine();
> if (line==null)
> more = false;
> else
> System.out.println( line );
> }
>
> My problem is that I can read out every HTML-code I get from websites within
> the LAN, but by trying to connect to public sites in the net I only get this
> exception:
> "java.net.SocketException: Unexpected end of file from server"
>
> Thanks for your help!
>
> Sven Junge
>
>


If you experience problems with accessing sites on the internet while
everything is fine within the LAN, I would suggest you to have a look at
the firewall settings.

btw, you'd better use InputStream rather than Reader

--
Song

/* E-mail.c */
#define User "Yu.Song"
#define Warwick "warwick.ac.uk"
int main() {
printf("Yu Song's E-mail: %s@%s", User, Warwick);
return 0;}

Further Info. : http://www.dcs.warwick.ac.uk/~esubbn/
__________________________________________________ _____

 
Reply With Quote
 
 
 
 
Sven Junge
Guest
Posts: n/a
 
      06-16-2004
No, that wasn't the problem.
I got a hint to add following code:

System.setProperty( "proxySet", "true" );
System.setProperty( "http.proxyHost", "MyProxyAddress" );
System.setProperty( "http.proxyPort", "MyProxyPort" );

Now it works fine.

thx

Sven
"Yu SONG" <(E-Mail Removed)> schrieb im Newsbeitrag
news:cap1d2$b1r$(E-Mail Removed)...
> Sven Junge wrote:
> > Hello,
> >
> > I'm behind a Firewall and trying to connect with the following code to

an
> > inet-address:
> >
> > URL url = new URL(urlStr);
> > InputStream uin = url.openStream();
> > BufferedReader in = new BufferedReader( new

InputStreamReader(uin));
> > boolean more = true;
> > while (more)
> > {
> > String line = in.readLine();
> > if (line==null)
> > more = false;
> > else
> > System.out.println( line );
> > }
> >
> > My problem is that I can read out every HTML-code I get from websites

within
> > the LAN, but by trying to connect to public sites in the net I only get

this
> > exception:
> > "java.net.SocketException: Unexpected end of file from server"
> >
> > Thanks for your help!
> >
> > Sven Junge
> >
> >

>
> If you experience problems with accessing sites on the internet while
> everything is fine within the LAN, I would suggest you to have a look at
> the firewall settings.
>
> btw, you'd better use InputStream rather than Reader
>
> --
> Song
>
> /* E-mail.c */
> #define User "Yu.Song"
> #define Warwick "warwick.ac.uk"
> int main() {
> printf("Yu Song's E-mail: %s@%s", User, Warwick);
> return 0;}
>
> Further Info. : http://www.dcs.warwick.ac.uk/~esubbn/
> __________________________________________________ _____
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments