Processing loadStrings from url

I using example for loading data from server

void mousePressed() {
  String url = "http://" + "www.ra001.lv/test.php";
  println("Mouse press");
  String[] lines = loadStrings(url);
  println(lines[0]);
  redraw();
}

I can change any address in load string but allways get error:

java.net.SocketException: Address family not supported by protocol family: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.URL.openStream(Unknown Source) at processing.core.PApplet.createInputRaw(PApplet.java:7233) at processing.core.PApplet.createInput(PApplet.java:7201) at processing.core.PApplet.loadStrings(PApplet.java:7538) at sketch_140929a.mousePressed(sketch_140929a.java:29) at processing.core.PApplet.mousePressed(PApplet.java:3085) at processing.core.PApplet.handleMouseEvent(PApplet.java:2831) at processing.core.PApplet.dequeueEvents(PApplet.java:2725) at processing.core.PApplet.postEvent(PApplet.java:2701) at processing.core.PApplet.nativeMouseEvent(PApplet.java:2976) at processing.core.PApplet.mousePressed(PApplet.java:2992) at java.awt.Component.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) The file "http://www.ra001.lv/test.php" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

Answers

  • edited September 2014

    "http: //

    Why do you insert a space between : & // for? [-(
    This 1 is more correct: String url = "http://" + "www.ra001.lv/test.php";

  • space is only here, but I can change any address, always get this error

  • I'm afraid I don't have a clue about it b/c it simply worked for me here: 8-|

    // forum.processing.org/two/discussion/7389/processing-loadstrings-from-url
    
    static final String URL = "http://" + "www.ra001.lv/test.php";
    
    void setup() {
      noLoop();
    }
    
    void draw() {
      background((color) random(#000000));
    }
    
    void mousePressed() {
      println(loadStrings(URL));
      redraw();
    }
    
  • Nope, same error. But I think this is some kind of security error, becouse on my work computer working fine all versions of code.

  • edited September 2014

    Address family not supported by protocol family...

    I guess your parents implanted some kinda family filter in your computer or the whole LAN! >:)

  • I am a parent! I remove all java versions, and install new, but nothing :-((

  • edited September 2014

    It's a java.net.SocketException related to some kinda "family" protocol! :@)
    I don't think Java got anything to do w/ that! /:)

  • edited September 2014

    Solved!

    Stackoverflow

    I remove software RelevantKnowledge

Sign In or Register to comment.