Find the answer to your Linux question:
Results 1 to 3 of 3
Code: import java.net.*; import java.io.*; public class sourceviewer { public static void main(String[] args){ if(args.length >0) { try{ URL u = new URL(args[0]); URLConnection uc = u.openConnection(); InputStream raw = ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2004
    Posts
    15

    networking problem with java in linux!!


    Code:
    import java.net.*;
    import java.io.*;
    
    public class sourceviewer {
    
    public static void main(String[] args){
    
    if(args.length >0) {
    try{
    URL u = new URL(args[0]);
    URLConnection uc = u.openConnection();
    InputStream raw = uc.getInputStream();
    InputStream buffer = new BufferedInputStream(raw);
    Reader r = new InputStreamReader(buffer);
    int c;
    while ((c = r.read()) != 1) {
    System.out.print((char) c);
    }
    }
    catch (MalformedURLException e) {
    System.err.println(args[0] + " is not parseable URL");
    }
    catch (IOException e){
    System.err.println(e);
    }
    }
    }
    }
    When i run this code it gives the following error message
    "java.net.ConnectException:Connection Refused"

    Well i am behind a firewall and i use proxy to access the net. Plzz help!!!


    ::moderator edit:: added CODE tags for readability -TM

  2. #2
    Linux Newbie
    Join Date
    Aug 2001
    Location
    USA, Texas
    Posts
    217
    in the future, please do not cross post and use the code tags to make your code more readable
    [ [ SykkN alloc ] initWithThePowerTo: destroyYouAll ];
    /* Don\'t make me use it! */

  3. #3
    Just Joined!
    Join Date
    Jul 2004
    Posts
    15
    Roger That!!! Commander

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •