Proxy-problem

Discussion in 'Java' started by Sven Junge, Jun 14, 2004.

  1. Sven Junge

    Sven Junge Guest

    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
     
    Sven Junge, Jun 14, 2004
    #1
    1. Advertising

  2. Sven Junge

    Yu SONG Guest

    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/
    _______________________________________________________
     
    Yu SONG, Jun 16, 2004
    #2
    1. Advertising

  3. Sven Junge

    Sven Junge Guest

    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" <> schrieb im Newsbeitrag
    news:cap1d2$b1r$...
    > 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/
    > _______________________________________________________
    >
     
    Sven Junge, Jun 16, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vidy5300
    Replies:
    0
    Views:
    885
    vidy5300
    Jun 7, 2004
  2. Replies:
    0
    Views:
    1,651
  3. Karsten Wutzke
    Replies:
    1
    Views:
    893
    Steven Simpson
    Aug 20, 2007
  4. Klein Stéphane
    Replies:
    3
    Views:
    607
    Steve Holden
    Dec 20, 2009
  5. Alejandro Molina

    Proxy and non Proxy configurations

    Alejandro Molina, Jul 15, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    153
    Alejandro Molina
    Jul 15, 2004
Loading...

Share This Page